#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 190
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open new record with selected fields from previous record Design by Sue Excel Discussion (Misc queries) 1 June 12th 09 02:24 PM
Record macro doesn't record shape properties Tosco[_2_] Excel Programming 3 May 30th 07 02:28 AM
Finding last record in month for each of several types of record. Richard Buttrey Excel Programming 5 April 4th 05 02:11 AM
Record Macro - Record custom user actions Sal[_4_] Excel Programming 1 December 23rd 04 03:18 PM
Need help autopopulating next new record with previous record data Harry S[_3_] Excel Programming 2 October 1st 03 10:59 PM


All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"