Setting Last Row

J

J.W. Aldridge

HI.

I am running a fill down macro and am needing some assistance....

How do I word the macro so that it goes down to a particular row?
(instead of searching a range or column).

I.e. - I need one of these to say the last row is always 500.



Set LastRow = Sheet1.Range("a65536").End(xlUp)
or
LastRow = Range("a65536:hc65536").End(xlUp).Row



Thanx
 
K

KLZA

HI.

I am running a fill down macro and am needing some assistance....

How do I word the macro so that it goes down to a particular row?
(instead of searching a range or column).

I.e. - I need one of these to say the last row is always 500.

Set LastRow = Sheet1.Range("a65536").End(xlUp)
or
LastRow = Range("a65536:hc65536").End(xlUp).Row

Thanx

Set LastRow = Sheet1.Range("a500:hc500").End(xlUp)
 
J

JW

Kinda confused. You just want the last row to always be 500? The
just substitute "500" for wherever you are using the LastRow
variable. Now, I could be completely misunderstanding your
perdicament.
 
J

J.W. Aldridge

Sounds simple but, not working when i change.
Here's the actual formula.
(I have info all the way from column A to HC, and this formula is
stopping wherever the data in column A is stopping).


Sub FillColBlanks_all()


Dim wks As Worksheet
Dim rng As Range
Dim LastRow As Long


Set wks = ActiveSheet


With wks

LastRow = Range("a500:hc500").End(xlUp).Row


Set rng = Nothing
On Error Resume Next
Set rng = .Range("A11:hc" &
LastRow).Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0


If rng Is Nothing Then
MsgBox "No blanks found"
Exit Sub
Else
rng.FormulaR1C1 = "=R[-1]C"
End If


End With


End Sub


thanx
 

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