I have recorded 2 Macros - one to copy a range of cells to the clipboard; the second to clear the relevant cells to start over.
I am a novice at VBA, so wondered how do I tidy things up; and how do I add in an extra piece of code to select extra rows dependent on whether they are empty or not?
TIA!!
____________________________________________________________________________________
I am a novice at VBA, so wondered how do I tidy things up; and how do I add in an extra piece of code to select extra rows dependent on whether they are empty or not?
TIA!!
VBA Code:
Sub Macro2_Export()
'
' Macro2_Export Macro
' Copies pre-selected cells to clipboard ready to paste into Oracle Loader.
'
'
Range("R6,F6:J6,L6,N6:O6,Q6,S6").Select
Range("S6").Activate
ActiveWindow.LargeScroll ToRight:=1
Range("R6,F6:J6,L6,N6:O6,Q6,S6,U6:V6,X6,Z6,AB6:AC6,AE6,AG6,AI6:AJ6,AL6").Select
Range("AL6").Activate
ActiveWindow.LargeScroll ToRight:=1
Range( _
"R6,F6:J6,L6,N6:O6,Q6,S6,U6:V6,X6,Z6,AB6:AC6,AE6,AG6,AI6:AJ6,AL6,AN6,AP6:AQ6,AS6,AU6,AW6:AX6,AZ6,BB6,BD6" _
).Select
Range("BD6").Activate
ActiveWindow.LargeScroll ToRight:=1
Range( _
"R6,F6:J6,L6,N6:O6,Q6,S6,U6:V6,X6,Z6,AB6:AC6,AE6,AG6,AI6:AJ6,AL6,AN6,AP6:AQ6,AS6,AU6,AW6:AX6,AZ6,BB6,BD6,BE6,BG6" _
).Select
Range("BG6").Activate
Selection.Copy
ActiveWindow.ScrollColumn = 55
ActiveWindow.ScrollColumn = 54
ActiveWindow.ScrollColumn = 53
ActiveWindow.ScrollColumn = 51
ActiveWindow.ScrollColumn = 50
ActiveWindow.ScrollColumn = 47
ActiveWindow.ScrollColumn = 44
ActiveWindow.ScrollColumn = 40
ActiveWindow.ScrollColumn = 36
ActiveWindow.ScrollColumn = 31
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 22
ActiveWindow.ScrollColumn = 18
ActiveWindow.ScrollColumn = 14
ActiveWindow.ScrollColumn = 10
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 1
Range("D6").Select
End Sub
VBA Code:
Sub Macro1_Clear()
'
' Macro1_Clear Macro
' Selects relevant cells & clears contents.
'
'
Range("D6,E6,F6,H6,I6,K6,M6,O6,P6,R6,T6").Select
Range("T6").Activate
ActiveWindow.LargeScroll ToRight:=1
Range("D6,E6,F6,H6,I6,K6,M6,O6,P6,R6,T6,V6,W6,Y6,AA6,AC6,AD6,AF6,AH6,AJ6,AK6"). _
Select
Range("AK6").Activate
ActiveWindow.LargeScroll ToRight:=1
ActiveWindow.SmallScroll ToRight:=-1
Range( _
"D6,E6,F6,H6,I6,K6,M6,O6,P6,R6,T6,V6,W6,Y6,AA6,AC6,AD6,AF6,AH6,AJ6,AK6,AM6,AO6,AQ6,AR6,AT6,AV6,AX6,AY6,BA6,BC6" _
).Select
Range("BC6").Activate
ActiveWindow.LargeScroll ToRight:=1
Union(Range( _
"BF6,D6,E6,F6,H6,I6,K6,M6,O6,P6,R6,T6,V6,W6,Y6,AA6,AC6,AD6,AF6,AH6,AJ6,AK6,AM6,AO6,AQ6,AR6,AT6,AV6,AX6,AY6,BA6,BC6" _
), Range("BE6")).Select
Range("BF6").Activate
Selection.ClearContents
Range("D6").Select
End Sub
Last edited by a moderator: