A little more help with code

wilkisa

Well-known Member
Joined
Apr 7, 2002
Messages
657
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
I have the following code:Sub Sample()

'Add new sheet
Sheets.Add

' Move sheet to end
ActiveSheet.Move After:=Sheets(Worksheets.Count)

ActiveSheet.[a7] = "Previous Value:"
ActiveSheet.[d7] = "Current Values:"
ActiveSheet.[d9] = "Total Value:"
ActiveSheet.[b7] = Sheets(Worksheets.Count - 1).[e7]

ActiveSheet.[e7] = "=SUM(R[-6]C:R[-1]C)"
ActiveSheet.[e9] = "=SUM(R[-2]C[-3],R[-2]C)"

ActiveSheet.[B7,E1:E9].NumberFormat = "0.00"

ActiveSheet.[A:E].ColumnWidth = 15
ActiveSheet.Range("E1").Select

End Sub


What I need to have changed is the reference to the ActiveSheet.[b7]. Instead of it being a hard number, I need it to be linked to the previous sheet so that it will update if a change is made in the previous sheet. Can someone help with this?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Fabulous, Andrew! You ROCK and so does this whole website!!!!!!!!


Thanks so much,
Shirlene
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top