Evening.
I am attempting to cleanup my code in VBA scripts and have read :-
"Two Main reasons why .Select/.Activate/Selection/Activecell/Activesheet/Activeworkbook etc... should be avoided" by Siddharth Rout
I have broken all the rules with the following scripting.
What I am trying to achieve is accomplished by the script. My difficulty in converting the scripts is that the workbook name "CMF Export.xlxs" changes depending on what branch of the business it is sent from.
'PARTNO & FULLDESC copy paste
Windows("HIDEDISPLAY.xlsx").Activate
Range("B:B,I:I").Select
Range("I1").Activate
Selection.Copy
Windows("CMF Export.xlsx").Activate
Range("C1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
I have used the following script get the name of the work book I want to copy to.
Function GetBook() As String
GetBook = ActiveWorkbook.Name
End Function
I just not have any clue on how I can combine this into one working script.
Thanks Mark