Run Macro one after the other
Hi,
I am trying a VBA, with multiple functions. When I run the macro, before one process is finished the second one start which does not give the desired result.
I want it to pause till the previous Sub is complete and then run the next line of commands.
Here is the code:
Code:
Sub UnmergeAllCells()
ActiveSheet.Cells.UnMerge
End Sub
Sub UnWrapTextAllCells()
Cells.WrapText = False
End Sub
Sub PasteSpecial_ValuesOnly()
'Copy A Range of Data
Worksheets("Sheet1").Range("S2").Copy
'PasteSpecial Values Only
Worksheets("Sheet2").Range("T2").PasteSpecial Paste:=xlPasteValues
'Clear Clipboard (removes "marching ants" around your original data set)
Application.CutCopyMode = False
End Sub
Sub RowAndColumnAutoFit()
Worksheets("Sheet1").Columns("A:BF").AutoFit
End Sub
Sub deleteMultipleRows()
Rows("3:6").Delete
End Sub
Sub DeleteColumns()
Worksheets("Sheet1").Range("A:C,E:F,H:J,L:S,U:X,Z:AB,AD:AH,AJ:BF").EntireColumn.Delete
End Sub