Help needed with code
Is this code in the middle of some sort of WITH statement? It doesn't
appear to be except for some periods in the code.
A several lines stand out.
LastColumn = .Cells(1, Columns.Count).End(xlToLeft).Column 'Try
removing period before "Cells".
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row 'Try
removing period before "Cells".
Set rng = .Range(Cells(1, 17), Cells(LastRow, LastColumn)) 'Try
removing period before "Range".
rng.Copy Destination:=NewbkS1.Range("E1")
oldbk.Activate
.Columns("H:H").AutoFilter Field:=1, Criteria1:="X"
'Try removing period before "Columns".
.Columns("C:F").Copy Destination:= _
'Try removing period before "Columns".
NewbkS1.Range("A1")
.Columns("K:Q").Copy Destination:= _
'Try removing period before "Columns".
NewbkS1.Range("E1")
HTH,
Paul
--
"Gemz" wrote in message
...
Hi,
I have this sample code but everytime i try to run it this line is
highlighted and nothing happens:
Set rng = .Range(Cells(1, 17), Cells(LastRow, LastColumn))
The rest of the code:
LastColumn = .Cells(1, Columns.Count).End(xlToLeft).Column
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
Set rng = .Range(Cells(1, 17), Cells(LastRow, LastColumn))
rng.Copy Destination:=NewbkS1.Range("E1")
oldbk.Activate
.Columns("H:H").AutoFilter Field:=1, Criteria1:="X"
.Columns("C:F").Copy Destination:= _
NewbkS1.Range("A1")
.Columns("K:Q").Copy Destination:= _
NewbkS1.Range("E1")
Whats going wrong?
please help, thanks!
|