ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting Last Row (https://www.excelbanter.com/excel-programming/394887-setting-last-row.html)

J.W. Aldridge

Setting Last Row
 
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


KLZA

Setting Last Row
 
On Aug 6, 1:57 pm, "J.W. Aldridge"
wrote:
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)


JW[_2_]

Setting Last Row
 
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.W. Aldridge wrote:
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



J.W. Aldridge

Setting Last Row
 

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



All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com