I have a question regarding macros. I built a macro in the order I want things done in my work book. But for some reason when I run the macro it will do the last part first, then it will run the rest of the macro.I think it may be doing this because the last part of my macro is a quicker process than the rest? I dont know. How do I prevent this? Below is my macro:
Sub test()
'
' test Macro
'
'
Sheets("Adhocs in odd locations").Select
Columns("B:B").Select
Selection.ClearContents
Sheets("Total").Select
ActiveWorkbook.RefreshAll
Sheets("Adhocs in odd locations").Select
Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(15, 1)), TrailingMinusNumbers:=True
Range("A3").Select
Selection.TextToColumns Destination:=Range("A3"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(19, 1)), TrailingMinusNumbers:=True
Range("A5").Select
Selection.TextToColumns Destination:=Range("A5"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(19, 1)), TrailingMinusNumbers:=True
Sheets("Total").Select
End Sub
The section that starts with "Sheets("Adhocs in odd locations")." is the part that will load first, I need it to load last.
Thanks in advance for your help.
Brian
Sub test()
'
' test Macro
'
'
Sheets("Adhocs in odd locations").Select
Columns("B:B").Select
Selection.ClearContents
Sheets("Total").Select
ActiveWorkbook.RefreshAll
Sheets("Adhocs in odd locations").Select
Range("A1").Select
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(15, 1)), TrailingMinusNumbers:=True
Range("A3").Select
Selection.TextToColumns Destination:=Range("A3"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(19, 1)), TrailingMinusNumbers:=True
Range("A5").Select
Selection.TextToColumns Destination:=Range("A5"), DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(19, 1)), TrailingMinusNumbers:=True
Sheets("Total").Select
End Sub
The section that starts with "Sheets("Adhocs in odd locations")." is the part that will load first, I need it to load last.
Thanks in advance for your help.
Brian