A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro question



 
 
Thread Tools Display Modes
  #1  
Old June 10th, 2004, 01:26 PM
Jim
external usenet poster
 
Posts: n/a
Default Macro question

My spreadsheet is as follows:
B C D E
2 6 5 6 7

B2 has the formula ='sheet1'!D7 which is linked to a web
query which is updated once per day. When the value
in 'sheet1'!D7 changes, B2 takes on the new value and C2
takes on the value of B2 and D2 takes on the value of C2
etc.

I am using the following macro,
Range("E2").value=Range("D2").value
Range("D2").value=Range("C2").value
Range("C2").value=Range("B2").value
Range("B2").value=""

The problem is that I am losing the cell reference in B2
ie: ='sheet1'!D7. Do you know how I should program the
macro to keep the reference to sheet1? Thanks.




  #2  
Old June 10th, 2004, 01:32 PM
Frank Kabel
external usenet poster
 
Posts: n/a
Default Macro question

Hi Jim
does this macro also update the web query?
If I understood you correctly this souds more like using a
worksheet_claculate event, checking if B2 has changed and if yes change
C2:E2 accordingly

--
Regards
Frank Kabel
Frankfurt, Germany


Jim wrote:
My spreadsheet is as follows:
B C D E
2 6 5 6 7

B2 has the formula ='sheet1'!D7 which is linked to a web
query which is updated once per day. When the value
in 'sheet1'!D7 changes, B2 takes on the new value and C2
takes on the value of B2 and D2 takes on the value of C2
etc.

I am using the following macro,
Range("E2").value=Range("D2").value
Range("D2").value=Range("C2").value
Range("C2").value=Range("B2").value
Range("B2").value=""

The problem is that I am losing the cell reference in B2
ie: ='sheet1'!D7. Do you know how I should program the
macro to keep the reference to sheet1? Thanks.


  #3  
Old June 10th, 2004, 08:41 PM
Earl Kiosterud
external usenet poster
 
Posts: n/a
Default Macro question

Jim,

The last line of the macro is clobbering your link, replacing it with " ".
Try leaving it out. Or as we say "remming it out" (putting an apostrophe in
front of it, turning it into a comment). I don't know when this macro runs,
so I don't know what you'll be left with.

--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Jim" wrote in message
...
My spreadsheet is as follows:
B C D E
2 6 5 6 7

B2 has the formula ='sheet1'!D7 which is linked to a web
query which is updated once per day. When the value
in 'sheet1'!D7 changes, B2 takes on the new value and C2
takes on the value of B2 and D2 takes on the value of C2
etc.

I am using the following macro,
Range("E2").value=Range("D2").value
Range("D2").value=Range("C2").value
Range("C2").value=Range("B2").value
Range("B2").value=""

The problem is that I am losing the cell reference in B2
ie: ='sheet1'!D7. Do you know how I should program the
macro to keep the reference to sheet1? Thanks.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:40 AM.


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