Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open new record with selected fields from previous record | Excel Discussion (Misc queries) | |||
Record macro doesn't record shape properties | Excel Programming | |||
Finding last record in month for each of several types of record. | Excel Programming | |||
Record Macro - Record custom user actions | Excel Programming | |||
Need help autopopulating next new record with previous record data | Excel Programming |