New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

Please Help! VBA Code

Macros, VBA, Excel Automation, etc.

Please Help! VBA Code

Postby driftjzx » Thu Dec 15, 2011 12:37 am

HI all,
I am needing a macro on a button click, that when pressed a cell on a different page is added by "x". Here is the part that I cant get to work, The button will be used on multiple pages and must run in the backround and stay on the same page. I wrote:

Sub pointone()
Dim x As Integer
Sheets("Data Sheet").Range("i7").Value = i7 + 0.01
End Sub

And this does what i need it to do, but replaces the cell with that amount and not add's it.

Can anyone help?
Kind regards,
Dean
  • 0

driftjzx
Rookie
 
Posts: 1
Joined: Dec 15, 2011
Reputation: 0

Re: Please Help! VBA Code

Postby Sisyphus » Thu Dec 15, 2011 3:55 am

Hi,

This should do the job:
Code: Select all
With Sheets("Datasheet").Range("I7")
    .Value = .Value + 0.01
End With


have a pleasant day! :D
  • 0

Have a great day! :D

Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)
Sisyphus
Former Moderator
 
Posts: 4454
Joined: Dec 7, 2011
Location: Shanghai
Reputation: 203
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 35 guests