Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 138
Default Updating a cell reference

I have a worksheet that gets data from a worksheet in another file. Each
month the cell references have to change to the next row. For example, this
month I'm referencing C134, which is the June line on the other file. Next
month, I need to reference C135, the July line.

How can I automate this? My first thought is to use a macro, but I can't
find an example anywhere of a VBA macro that moves a cell reference to the
next row.

Any suggestions would be appreciated.

Thank you,
Paula
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Updating a cell reference

To find the correct column you need to search the header row of the worksheet
for the correct month. You can do this either with a worksheet function of
VBA macro. the VBA macro would look like this

set bk = workbooks.open(filename:="book1.xls")
sest sht = bk.sheets("Sheets1")

set c = sht.rows(1).find(what:="June",lookin:=xlvalues ,lookat:=xlwhole)
if c is nothing then
msgbox("could not find June")
else
LastColumn = c.column
end if

"Paula" wrote:

I have a worksheet that gets data from a worksheet in another file. Each
month the cell references have to change to the next row. For example, this
month I'm referencing C134, which is the June line on the other file. Next
month, I need to reference C135, the July line.

How can I automate this? My first thought is to use a macro, but I can't
find an example anywhere of a VBA macro that moves a cell reference to the
next row.

Any suggestions would be appreciated.

Thank you,
Paula

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Updating a cell reference

Hi,
What you can do is to have a sheet (I call it "Reference"column A the month
and column B the cell reference starting in row 2)with a list of the month
and the cell reference, you can hide this tab, then somewhere your
spreadsheet you have the actual month let's say in A1, I suppose that the
cell referencing is in B2 so there enter
=sumproduct(--(A1=reference!$A$2:$A$14),reference!$b$2:$b$14)


"Paula" wrote:

I have a worksheet that gets data from a worksheet in another file. Each
month the cell references have to change to the next row. For example, this
month I'm referencing C134, which is the June line on the other file. Next
month, I need to reference C135, the July line.

How can I automate this? My first thought is to use a macro, but I can't
find an example anywhere of a VBA macro that moves a cell reference to the
next row.

Any suggestions would be appreciated.

Thank you,
Paula

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default Updating a cell reference

Paula,

You have a lot of options.

1) Select the cells and do a find and replace of 134 with 135, choosing the look in formulas option.

2) Copy the cells down one row, then delete the old cells - will work if you are not specifically
referencing the old cells.

3) Change your formulas to something something that will auto-update, like

=OFFSET(C128,DATEDIF(DATEVALUE("1/1/2009"),NOW(),"m"),0)


HTH,
Bernie
MS Excel MVP


"Paula" wrote in message
...
I have a worksheet that gets data from a worksheet in another file. Each
month the cell references have to change to the next row. For example, this
month I'm referencing C134, which is the June line on the other file. Next
month, I need to reference C135, the July line.

How can I automate this? My first thought is to use a macro, but I can't
find an example anywhere of a VBA macro that moves a cell reference to the
next row.

Any suggestions would be appreciated.

Thank you,
Paula



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
Cell Reference updating bardebe Charts and Charting in Excel 0 August 20th 08 12:19 PM
Updating a reference ROW Deskpilot Excel Discussion (Misc queries) 2 July 10th 08 02:46 PM
Updating Indirect Reference(s) Sunrise TG Excel Worksheet Functions 3 February 7th 07 10:41 PM
Updating cells which reference a defined name Mike Miller Excel Discussion (Misc queries) 1 November 9th 06 01:06 AM
problem with cell reference in =sum(offset(cell reference,x,y,z,a)). Want cell ref to be variable. [email protected] Excel Worksheet Functions 2 December 11th 04 12:05 AM


All times are GMT +1. The time now is 08:38 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"