Every 4th cell is blank and stops my macro!

S

Sandeman

I am trying to run the following Macro and I'm not having any troubl
except every 4th row in the dataset is blank, causing this macro t
stop dead in its tracks. What can I do to add "filler" data in ever
4th row for the length of the dataset or perhaps delete every 4th ro
and move the data up?

Thanks particularly to Tom O. who has been a great help this week.

Dim rng As Range
With Worksheets("Sheet1")
Set rng = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
End With
With Worksheets("Sheet2")
.Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
End Wit
 
A

Ardus Petus

Dim rng As Range
With Worksheets("Sheet1")

Set rng = .Range(.Cells(2, 1), .Cells(Rows.Count 1).End(xlUp))

End With
With Worksheets("Sheet2")
Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
End With

HTH
--
AP

"Sandeman" <[email protected]> a écrit
dans le message de
news:[email protected]...
 
T

Tom Ogilvy

Dim rng As Range
With Worksheets("Sheet1")
Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlUp))
End With
With Worksheets("Sheet2")
..Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
End With

or if you want to delete the rows

Dim rng As Range
With Worksheets("Sheet1")
Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlUp))
rng.specialcells(xlblanks).Entirerow.Delete
Set rng = .Range(.Cells(2, 1), .Cells(rows.count, 1).End(xlUp))
End With
With Worksheets("Sheet2")
..Range(rng.Address).FormulaR1C1 = "=Sheet1!RC"
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top