Find Last Row + 1

G

Guest

I have used the following code to put the formula in a specific column all
the way to the last cell. It is working good, except it misses the last row.
Is there a way to force it to go one row extra. Any help will be
apprecaited. Thanks!


Dim rng As Range
With Worksheets("CIP Exceptions")
Set rng = .Range(.Cells(5, 5), .Cells(Rows.Count, 5).End(xlUp))
End With
rng.Offset(0, 1).Formula = "=TEXT(E5,""mmmm"")"
 
A

Ardus Petus

Set rng = .Range(.Cells(5, 5), .Cells(Rows.Count,
5).End(xlUp)).offset(1,0)


HTH
 
G

Guest

Set r = ActiveSheet.UsedRange

nLastRow = r.Rows.Count + r.Row - 1
yields the last row
nOneStepBeyond = r.Rows.Count + r.Row
the next row
 
G

Guest

Use an offset kinda like this...

Dim rng As Range
With Worksheets("CIP Exceptions")
Set rng = .Range(.Cells(5, 5), .Cells(Rows.Count,
5).End(xlUp).offset(1,0))
End With
rng.Offset(0, 1).Formula = "=TEXT(E5,""mmmm"")"
 
G

Guest

I think that will offset the entire range, not just add one more row to it...
I think the offset needs to be inside the final bracket...
 
A

Ardus Petus

You are quite right! I misread the original code.
Should be:
Set rng = .Range(.Cells(5, 5), .Cells(Rows.Count, 5).End(xlUp).offset(1,0))

Sorry,
 
D

Dave Peterson

It looks like you should be using another column besides E to get that last
row???

Dim rng As Range
With Worksheets("CIP Exceptions")
Set rng = .Range(.Cells(5, 5), .Cells(Rows.Count, 5).End(xlUp))
End With
with rng
.resize(.rows.count+1).Offset(0, 1).Formula = "=TEXT(E5,""mmmm"")"
end with

Is one more way.
 

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