Skip to main content

Posts

Showing posts from July, 2023

Excel VBA Split data to individual workbooks and save to folders.

  Another Excel automation shortcut. This VBA does Cinderella's job, of separating lentils from cinders and sorting them to separate pots! So excel data like one below, Sorted as per User ( Column A) and ranges of each user saved to a separate working in the specified folder as per Hyperlink. Default folder has to be assigned  as a backup, in cases where we did not specify folder for the User. User4 Data was saved to Default Folder as we did not have folder created at the time of split. Simple enough VBA, which can be improved by checking if file is open and close it, or make sure VBA saves files with unique name. (If you watch the video, you can notice I got Debug ) File to Download Code  Sub Splitter() Dim DataWS, LnksWS As Worksheet Dim Hdr, UsrRng, topCell, btmCell, c, copyRng, lCell, dateC, fndLink As Range Dim usr, usrC, copyR, MyPath, fName, mnth, yr, dflt, msgText As String Dim r1, r2 As Integer msgText = "" Set LnksWS = Sheets("Links") If LnksWS Is Not...

Excel VBA Universal Appender 2.0 Appends data from different Workbooks to One

  This useful VBA is an adapted code from unknown source and author, please make yourself known for a credit and accept my huge gratitude for sharing your knowledge! The original code  worked very well for a "full table" data, but for random data the code did not work, chopping few lines off. Range("A1").SpecialCells(xlCellTypeLastCell).Address or  Cells.SpecialCells(xlCellTypeLastCell).Address fixed this issue File for grabs   VBA Module Public ext, TabNametxt, ShtPswrd As String, newBk As Integer   Public Sub AppenderNew() Dim MyPath, FilesInPath, MyFiles(), lAddr As String Dim SourceRcount, rnum, Fnum, CalcMode, TabNameNum As Long Dim mybook, Appender As Workbook, BaseWks, TabNameWS As Worksheet Dim sourceRange As Range, destrange As Range Dim TabName As Variant Dim fldr As FileDialog Dim answer As Integer SelectExt.Show     If ext = "" Then         Exit Sub     Else       ...