last record
hi,
i have the following: Dim lastrecordAGING As Long Range("AE5000").End(xlUp).Offset(0, 0).Select lastrecordAGING = Selection.Row Range("E2").End(xlToRight).Offset(0, 1).Select Range(Selection, Selection.End(xlDown)).Select i am trying to figure out how i can amend the lasdt line so that it only selects up to the lastrecordAGING. thanks in advance, geebee |
last record
Hi,
If I've understood correctly, try this:- Sub stance() Dim lastrecordAGING As Long lastrecordAGING = Range("AE5000").End(xlUp).Offset(0, 0).Row lastcell = Range("E2").End(xlToRight).Offset(0, 1).Address Range(lastcell & ":AE" & lastrecordAGING).Select End Sub Mike "geebee" wrote: hi, i have the following: Dim lastrecordAGING As Long Range("AE5000").End(xlUp).Offset(0, 0).Select lastrecordAGING = Selection.Row Range("E2").End(xlToRight).Offset(0, 1).Select Range(Selection, Selection.End(xlDown)).Select i am trying to figure out how i can amend the lasdt line so that it only selects up to the lastrecordAGING. thanks in advance, geebee |
last record
On May 22, 12:33*pm, geebee (noSPAMs) wrote:
hi, i have the following: Dim lastrecordAGING As Long * *Range("AE5000").End(xlUp).Offset(0, 0).Select * * lastrecordAGING = Selection.Row Range("E2").End(xlToRight).Offset(0, 1).Select Range(Selection, Selection.End(xlDown)).Select i am trying to figure out how i can amend the lasdt line so that it only selects up to the lastrecordAGING. thanks in advance, geebee One way Sub likeThis() Dim lRow As Long lRow = Cells(Rows.Count, "AE").End(xlUp).Row Range("E2:" & Cells(lRow, Range("E2").End(xlToRight) _ .Offset(0, 1).Column).Address).Select End Sub |
last record
hi,
this recommended code looks like it selects the last row like its supposed to, but it selects too many columns. i just want it to select the most recently added column. here is the code i have. the line which adds the new column is maked with "*" Range("E1").End(xlToRight).Offset(0, 0).Select Selection.Copy Range("E1").End(xlToRight).Offset(0, 1).Select "*" Selection.Value = Format(CurrentReportMonth, "mmm-yy") Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ "*" SkipBlanks:=False, Transpose:=False Dim lRow As Long lRow = Cells(Rows.Count, "AE").End(xlUp).Row Range("H2:" & Cells(lRow, Range("H2").End(xlToRight) _ ..Offset(0, 1).Column).Address).Select thanks in advance, geebee "JW" wrote: On May 22, 12:33 pm, geebee (noSPAMs) wrote: hi, i have the following: Dim lastrecordAGING As Long Range("AE5000").End(xlUp).Offset(0, 0).Select lastrecordAGING = Selection.Row Range("E2").End(xlToRight).Offset(0, 1).Select Range(Selection, Selection.End(xlDown)).Select i am trying to figure out how i can amend the lasdt line so that it only selects up to the lastrecordAGING. thanks in advance, geebee One way Sub likeThis() Dim lRow As Long lRow = Cells(Rows.Count, "AE").End(xlUp).Row Range("E2:" & Cells(lRow, Range("E2").End(xlToRight) _ .Offset(0, 1).Column).Address).Select End Sub |
last record
hi,
never mind, i figured it out. thanks "geebee" wrote: hi, this recommended code looks like it selects the last row like its supposed to, but it selects too many columns. i just want it to select the most recently added column. here is the code i have. the line which adds the new column is maked with "*" Range("E1").End(xlToRight).Offset(0, 0).Select Selection.Copy Range("E1").End(xlToRight).Offset(0, 1).Select "*" Selection.Value = Format(CurrentReportMonth, "mmm-yy") Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ "*" SkipBlanks:=False, Transpose:=False Dim lRow As Long lRow = Cells(Rows.Count, "AE").End(xlUp).Row Range("H2:" & Cells(lRow, Range("H2").End(xlToRight) _ .Offset(0, 1).Column).Address).Select thanks in advance, geebee "JW" wrote: On May 22, 12:33 pm, geebee (noSPAMs) wrote: hi, i have the following: Dim lastrecordAGING As Long Range("AE5000").End(xlUp).Offset(0, 0).Select lastrecordAGING = Selection.Row Range("E2").End(xlToRight).Offset(0, 1).Select Range(Selection, Selection.End(xlDown)).Select i am trying to figure out how i can amend the lasdt line so that it only selects up to the lastrecordAGING. thanks in advance, geebee One way Sub likeThis() Dim lRow As Long lRow = Cells(Rows.Count, "AE").End(xlUp).Row Range("E2:" & Cells(lRow, Range("E2").End(xlToRight) _ .Offset(0, 1).Column).Address).Select End Sub |
All times are GMT +1. The time now is 05:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com