Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keeping Subscripts Throughout

Status
Not open for further replies.

sarcazmo

Technical User
Apr 6, 2005
11
US
How do you keep equations intact from page to page as illustrated here:

V_ADUVLO-R where it must read: V-ADuvlo-r

where the "uvlo-r" is in subscript.

This entry will periodically change and effect the subsequent pages. I want the separate pages to recognize the change on the master page.

How can I do this?

I know you guys are fantastic here, so your input is very valuable. This question is probably entirely basic to you braniacs, but most appreciated here in Raleigh, NC.

Thanks, guys!

~Sarcazmo~

 
I'm assuming you are using Word. You can copy it the equation and when you paste it, paste it as a link. That way if you change it on the master page and subsequent pages will automatically be updated. To paste as a link, use Edit - Paste Special - Paste link to paste it.
 
Thank you! But I'm using Excel. Would the same methodology apply?
 
hi sarcazmo,

In Excel, referencing a cell with differently-formatted characters does not carry the character formats across, even if you use Edit|Paste Special|Format or Edit|Paste Special|Paste Link. A straight copy & paste will do so, however, but then you lose the automatic updates.

One way around this would be to use an event-driven macro to copy & paste the data to all the target sheets each time the entry on the source sheet is updated.

Cheers
 
Oh, that just sucks the big one. Event driven macro? That's a whole other enchilada - one I've never bitten in to. How do you do that? Yikes! Thanks for help!
 
Hi sarcazmo,

The code below reacts to changes to Cell A1 on Sheet1. When the value of that cell changes, the macro copies it into cell A1 on all the other sheets too.

Assuming you know how to create a vba module, in a new VBA module, enter the following code:

Public Flag As Integer
Sub Update()
Dim oSheet As Worksheet, oActvSht As Worksheet
Set oActvSht = ActiveSheet ' set starting sheet
Range("Sheet1!A1").Copy
' loop through all sheets in WB
For Each oSheet In ActiveWorkbook.Worksheets
oSheet.Activate
ActiveSheet.Paste Destination:=Range("A1")
Next oSheet
oActvSht.Activate ' go back to starting sheet
Application.CutCopyMode = False
Flag = 0
End Sub

Then, in the VBA Editor's Project Explorer window, double-click the entry for Sheet1. You should now see two drop-downs at the top of the code window. One is called (General); the other is called (Declarations). In the first drop-down, choose Worksheet. In the second, choose Change. Now the following lines appear in the code window:

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Between these two lines, type:

If Target.Cells(1, 1) = Range("A1") And Flag = 0 Then
Flag = 1
Update
End If

The Worksheet_Change procedure triggers the Update procedure whenever a change occurs in cell Al. The Update procedure does the copying, and pasting. The Public Flag variable, shared between the two procedures, ensures that the whole operation occurs only once with each change to Al. Without this, Excel regards the copying of A1 as a change and would repeat the Update procedure endlessly.

Cheers

 
macro! Thank you so much! Thank you for taking the time out to go into epth on this. I really appreciate it. It saved me a ton of time.

I love this forum.

Thanks again,
Sarcazmo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top