Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have played with this code but I can not make it work. Can someone please
help me fix this? My company has the help files locked out. comes back as Compile error: For without Next. Sub copy_rows() Dim lastrow As Long, i As Long Dim wksToSearch As Worksheet Dim rngToSearch As Range Dim rngFound As Range lastrow = Sheets("Sheet1").Cells(Rows.Count, 3).End(xlUp).Row For i = lastrow To 1 Step -1 Set wksToSearch = Sheets("Sheet1") Set rngToSearch = wksToSearch.Columns("C") Set rngFound = rngToSearch.Find(What:=ActiveCell, LookIn:=xlValue) If rngFound Is Nothing Then MsgBox "No data found" Else wksToSearch.Select rngFound.EntireRow.Copy Sheets("Sheet2").Range("A3") End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't Copy and Paste or Paste Special between Excel Workbooks | Excel Discussion (Misc queries) | |||
Automating copy/paste/paste special when row references change | Excel Programming | |||
help w/ generic copy & paste/paste special routine | Excel Programming | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming |