View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gemz Gemz is offline
external usenet poster
 
Posts: 86
Default Help needed with code

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!