Thread: skip blank rows
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Louie Louie is offline
external usenet poster
 
Posts: 40
Default skip blank rows

thank you mauro! it worked!

"Mauro Gamberini" wrote:

Public Sub m()

On Error GoTo ErrorRow

Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim lLastRow As Long
Dim rng As Range

With Application
.ScreenUpdating = False
.Calculation = xlManual
.StatusBar = "Runs: Sub m()"
End With

Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")

With sh1
lLastRow = _
.Range("D" & Rows.Count).End(xlUp).Row
Set rng = _
.Range("D2:D" & _
lLastRow).SpecialCells( _
xlCellTypeConstants)
rng.Copy sh2.Range("B2")
End With

ExitRow:
Set rng = Nothing
Set sh2 = Nothing
Set sh1 = Nothing
With Application
.ScreenUpdating = True
.Calculation = xlAutomatic
.StatusBar = ""
End With
Exit Sub

ErrorRow:
MsgBox Err.Number & vbNewLine & Err.Description
Resume ExitRow

End Sub


--
---------------------------
Mauro Gamberini
http://www.riolab.org/
"louie" ha scritto nel messaggio
...
how do i skip blank rows? sheet 1 has d10=alex, d17=ben, d24=carlo, i
transferred them to sheet 2,