A little more help with code

wilkisa

Well-known Member
Joined
Apr 7, 2002
Messages
651
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2007
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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

wilkisa

Well-known Member
Joined
Apr 7, 2002
Messages
651
Office Version
  1. 365
  2. 2016
  3. 2013
  4. 2007
Platform
  1. Windows
Fabulous, Andrew! You ROCK and so does this whole website!!!!!!!!


Thanks so much,
Shirlene
 

Forum statistics

Threads
1,143,923
Messages
5,721,557
Members
422,370
Latest member
A Nonomus

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
Top