Christina has attended:
Excel VBA Intro Intermediate course
Macros
Is there a particular macro command I can use to count empty columns, rather than cells?
Is there a particular macro command to automatically save the workbook after the macro is done?
Is there a particular macro command to generate new workbooks rather than new tabs?
RE: Macros
Hi Christina
3 macro questions already!
Thanks very much they are very good and useful questions.
The first one I found from Google which originally counted blank rows.
The code for your other two questions were by recording.
Sub CountBlankColumns()
Dim Col As Long, ColCount As Long, Rng As Range
Set Rng = Selection
ColCount = 0
For Col = Rng.Columns.Count To 1 Step -1
If Application.WorksheetFunction.CountA(Rng.Columns(Col).EntireColumn) = 0 Then
ColCount = ColCount + 1
End If
Next Col
MsgBox ColCount & " columns found"
End Sub
Sub CreateandSave()
Workbooks.Add
ChDir "Z:\"
ActiveWorkbook.SaveAs Filename:="Z:\Christina.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
End Sub
Instead of "Z:\" you can add your own file path for saving to
Hope that helps.
Regards
Doug
Best STL