Daph1990
09-22-2017, 04:06 AM
Hello everyone,
Hoping someone can help. I've got some data in a table and one of the columns (L) has a value of "Yes" or "No". I would like a code to be able to copy across columns B, C, D, E and K to a new workbook (along with the column headings) if Column L has a value of "No".
After this I would then like to be able to split the newly copied data into separate tabs based on Column C. So for example if column C says "Property" I'd like all those that say "Property" on its own tab and I'd like this to continue across all the different categories in column C (6 different categories included).
This far I've only managed to add a new workbook but I get a little stuck after that. I've attached a dummy file showing what the data looks like. This is the code I have so far:
Dim wb As WorkbookDim FileName As String
Set wb = Workbooks.Add
Application.DisplayAlerts = False
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
'If user has specified file name, perform Save and display a message box
If fileSaveName <> False Then
ActiveWorkbook.SaveAs FileName:=fileSaveName, FileFormat:=52
MsgBox "Save as " & fileSaveName
End If
Application.DisplayAlerts = True
Thank you so much!
Hoping someone can help. I've got some data in a table and one of the columns (L) has a value of "Yes" or "No". I would like a code to be able to copy across columns B, C, D, E and K to a new workbook (along with the column headings) if Column L has a value of "No".
After this I would then like to be able to split the newly copied data into separate tabs based on Column C. So for example if column C says "Property" I'd like all those that say "Property" on its own tab and I'd like this to continue across all the different categories in column C (6 different categories included).
This far I've only managed to add a new workbook but I get a little stuck after that. I've attached a dummy file showing what the data looks like. This is the code I have so far:
Dim wb As WorkbookDim FileName As String
Set wb = Workbooks.Add
Application.DisplayAlerts = False
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Macro-Enabled Workbook (*.xlsm), *.xlsm")
'If user has specified file name, perform Save and display a message box
If fileSaveName <> False Then
ActiveWorkbook.SaveAs FileName:=fileSaveName, FileFormat:=52
MsgBox "Save as " & fileSaveName
End If
Application.DisplayAlerts = True
Thank you so much!