Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default need to reference a cell from a changing range

In a worksheet each month results change the amount of rows in column 'B'.
Jan ends at B24, Feb at B32 and so on. From the last cell in column 'B' I
want to move one cell down and one cell to the left (Jan to A25, Feb to A33)
but I don't know the VBA code to do this.
--
Louie appreciates your help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default need to reference a cell from a changing range

First, get the last row number for column B.
Dim lastRow As Long
lastRow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row

Then to get the cell down 1 and left 1.

Set myRange = Cells(lastRow +1, 1) 'The cell in Col A

Put it in a procedu

Sub getmyRange()
Dim lastRow As Long
lastRow = ActiveSheet.Cells(Rows.Count, 2).End(xlUp).Row
Set myRange = Cells(lastRow +1, 1) 'The cell in Col A
MsgBox myRange.Address
End Sub


"Louie" wrote:

In a worksheet each month results change the amount of rows in column 'B'.
Jan ends at B24, Feb at B32 and so on. From the last cell in column 'B' I
want to move one cell down and one cell to the left (Jan to A25, Feb to A33)
but I don't know the VBA code to do this.
--
Louie appreciates your help!

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
changing absolute reference for range of cells marpat Excel Worksheet Functions 4 October 29th 08 05:15 PM
Copying a named range with a changing cell reference [email protected] New Users to Excel 1 February 21st 08 07:49 AM
Changing sheet reference to cell reference TeeJay Excel Worksheet Functions 3 October 19th 07 11:50 AM
Reference a changing range SD Excel Worksheet Functions 5 May 31st 07 11:05 PM
changing range reference Lawlera Excel Programming 3 April 15th 04 02:06 PM


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

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

About Us

"It's about Microsoft Excel"