Microsoft Office Forums


Reply
Thread Tools Display Modes

Excel question

 
 
Swinder
Guest
Posts: n/a

 
      02-07-2010, 08:35 PM
I have a very basic spreadsheet with data in it. What I want to be
able to do is add a button that a user can click which will execute a
basic command of simply adding a fixed amount (like +7) to a specific
set of the data and another amount to another column of data. I
imagine this is pretty simple to do, but I can not quite figure it
out.

~Thanks.
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a

 
      02-07-2010, 10:12 PM
sub addnum()
for each c in selection
c.value = c.value+7
next c
end sub

game time

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Swinder" <(E-Mail Removed)> wrote in message
news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...
>I have a very basic spreadsheet with data in it. What I want to be
> able to do is add a button that a user can click which will execute a
> basic command of simply adding a fixed amount (like +7) to a specific
> set of the data and another amount to another column of data. I
> imagine this is pretty simple to do, but I can not quite figure it
> out.
>
> ~Thanks.


 
Reply With Quote
 
Swinder
Guest
Posts: n/a

 
      02-08-2010, 03:22 AM
On Feb 7, 6:12*pm, "Don Guillett" <dguille...@gmail.com> wrote:
> sub addnum()
> for each c in selection
> c.value = c.value+7
> next c
> end sub
>
> game time
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message
>
> news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...
>
>
>
> >I have a very basic spreadsheet with data in it. What I want to be
> > able to do is add a button that a user can click which will execute a
> > basic command of simply adding a fixed amount (like +7) to a specific
> > set of the data and another amount to another column of data. I
> > imagine this is pretty simple to do, but I can not quite figure it
> > out.

>
> > ~Thanks.


Appreciate the reply, I am afraid my inexperience here is getting the
best of me though. Not really sure what to do with the info you gave
me.
 
Reply With Quote
 
Swinder
Guest
Posts: n/a

 
      02-08-2010, 03:28 AM
On Feb 7, 6:12*pm, "Don Guillett" <dguille...@gmail.com> wrote:
> sub addnum()
> for each c in selection
> c.value = c.value+7
> next c
> end sub
>
> game time
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message
>
> news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...
>
>
>
> >I have a very basic spreadsheet with data in it. What I want to be
> > able to do is add a button that a user can click which will execute a
> > basic command of simply adding a fixed amount (like +7) to a specific
> > set of the data and another amount to another column of data. I
> > imagine this is pretty simple to do, but I can not quite figure it
> > out.

>
> > ~Thanks.


Thanks for the quick reply! I get how this works within the
 
Reply With Quote
 
Swinder
Guest
Posts: n/a

 
      02-08-2010, 03:30 AM
On Feb 7, 6:12*pm, "Don Guillett" <dguille...@gmail.com> wrote:
> sub addnum()
> for each c in selection
> c.value = c.value+7
> next c
> end sub
>
> game time
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message
>
> news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...
>
>
>
> >I have a very basic spreadsheet with data in it. What I want to be
> > able to do is add a button that a user can click which will execute a
> > basic command of simply adding a fixed amount (like +7) to a specific
> > set of the data and another amount to another column of data. I
> > imagine this is pretty simple to do, but I can not quite figure it
> > out.

>
> > ~Thanks.


Thanks for the fast reply. I understand how to put that in VB and I
see where I can select cells and then run it and have it make the
change. Is there a way though I can make like a button or something on
the worksheet itself that I can simply click on to have it run this
without having to select the cells and then go into the VB editor
every time? That part I can't seem to get.
 
Reply With Quote
 
L. Howard Kittle
Guest
Posts: n/a

 
      02-08-2010, 04:09 AM
Add a button to the sheet and assign this code to it. Adapt MyRange to suit
your sheet needs.

Sub addnum()
Dim MyRange As Range
Dim c As Range
Set MyRange = Range("F1:F10")
' Or for multiple ranges
'Set MyRange = Range("F1:F10,H1:J5")
For Each c In MyRange
c.Value = c.Value + 7
Next c
End Sub

HTH
Regards,
Howard

"Swinder" <(E-Mail Removed)> wrote in message
news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...
>I have a very basic spreadsheet with data in it. What I want to be
> able to do is add a button that a user can click which will execute a
> basic command of simply adding a fixed amount (like +7) to a specific
> set of the data and another amount to another column of data. I
> imagine this is pretty simple to do, but I can not quite figure it
> out.
>
> ~Thanks.



 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a

 
      02-08-2010, 12:18 PM
Get a button or shape or any shape from anywhere and right click on it to
assign to the macro.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Swinder" <(E-Mail Removed)> wrote in message
news:8e582cd5-1d23-42d7-b006-(E-Mail Removed)...
On Feb 7, 6:12�pm, "Don Guillett" <dguille...@gmail.com> wrote:
> sub addnum()
> for each c in selection
> c.value = c.value+7
> next c
> end sub
>
> game time
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message
>
> news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...
>
>
>
> >I have a very basic spreadsheet with data in it. What I want to be
> > able to do is add a button that a user can click which will execute a
> > basic command of simply adding a fixed amount (like +7) to a specific
> > set of the data and another amount to another column of data. I
> > imagine this is pretty simple to do, but I can not quite figure it
> > out.

>
> > ~Thanks.


Thanks for the fast reply. I understand how to put that in VB and I
see where I can select cells and then run it and have it make the
change. Is there a way though I can make like a button or something on
the worksheet itself that I can simply click on to have it run this
without having to select the cells and then go into the VB editor
every time? That part I can't seem to get.

 
Reply With Quote
 
Swinder
Guest
Posts: n/a

 
      02-08-2010, 05:25 PM
On Feb 8, 8:18*am, "Don Guillett" <dguille...@gmail.com> wrote:
> Get a button or shape or any shape from anywhere and right click on it to
> assign to the macro.
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message
>
> news:8e582cd5-1d23-42d7-b006-(E-Mail Removed)...
> On Feb 7, 6:12 pm, "Don Guillett" <dguille...@gmail.com> wrote:
>
>
>
>
>
> > sub addnum()
> > for each c in selection
> > c.value = c.value+7
> > next c
> > end sub

>
> > game time

>
> > --
> > Don Guillett
> > Microsoft MVP Excel
> > SalesAid Software
> > dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message

>
> >news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)....

>
> > >I have a very basic spreadsheet with data in it. What I want to be
> > > able to do is add a button that a user can click which will execute a
> > > basic command of simply adding a fixed amount (like +7) to a specific
> > > set of the data and another amount to another column of data. I
> > > imagine this is pretty simple to do, but I can not quite figure it
> > > out.

>
> > > ~Thanks.

>
> Thanks for the fast reply. I understand how to put that in VB and I
> see where I can select cells and then run it and have it make the
> change. Is there a way though I can make like a button or something on
> the worksheet itself that I can simply click on to have it run this
> without having to select the cells and then go into the VB editor
> every time? That part I can't seem to get.


Ok so I was able to create a button and I see how to edit the macro in
it to have it do what I want. Unfortunately now when I try to actually
click on it to run it it tells me: "Can not run the macro. The macro
may not be available in this workbook or all macros may be disabled."
I have it set to enable all macros.
 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a

 
      02-08-2010, 05:35 PM
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Swinder" <(E-Mail Removed)> wrote in message
news:74ab6318-f1a6-461f-8551-(E-Mail Removed)...
On Feb 8, 8:18�am, "Don Guillett" <dguille...@gmail.com> wrote:
> Get a button or shape or any shape from anywhere and right click on it to
> assign to the macro.
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message
>
> news:8e582cd5-1d23-42d7-b006-(E-Mail Removed)...
> On Feb 7, 6:12 pm, "Don Guillett" <dguille...@gmail.com> wrote:
>
>
>
>
>
> > sub addnum()
> > for each c in selection
> > c.value = c.value+7
> > next c
> > end sub

>
> > game time

>
> > --
> > Don Guillett
> > Microsoft MVP Excel
> > SalesAid Software
> > dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message

>
> >news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)...

>
> > >I have a very basic spreadsheet with data in it. What I want to be
> > > able to do is add a button that a user can click which will execute a
> > > basic command of simply adding a fixed amount (like +7) to a specific
> > > set of the data and another amount to another column of data. I
> > > imagine this is pretty simple to do, but I can not quite figure it
> > > out.

>
> > > ~Thanks.

>
> Thanks for the fast reply. I understand how to put that in VB and I
> see where I can select cells and then run it and have it make the
> change. Is there a way though I can make like a button or something on
> the worksheet itself that I can simply click on to have it run this
> without having to select the cells and then go into the VB editor
> every time? That part I can't seem to get.


Ok so I was able to create a button and I see how to edit the macro in
it to have it do what I want. Unfortunately now when I try to actually
click on it to run it it tells me: "Can not run the macro. The macro
may not be available in this workbook or all macros may be disabled."
I have it set to enable all macros.

 
Reply With Quote
 
Swinder
Guest
Posts: n/a

 
      02-08-2010, 09:48 PM
On Feb 8, 1:35*pm, "Don Guillett" <(E-Mail Removed)> wrote:
> * * * If desired, send your file to my address below. I will only look if:
> * * * 1. You send a copy of this message on an inserted sheet
> * * * 2. You give me the newsgroup and the subject line
> * * * 3. You send a clear explanation of what you want
> * * * 4. You send before/after examples and expected results.
>
> --
> Don Guillett
> Microsoft MVP Excel
> SalesAid Software
> (E-Mail Removed)"Swinder" <(E-Mail Removed)> wrote in message
>
> news:74ab6318-f1a6-461f-8551-(E-Mail Removed)...
> On Feb 8, 8:18 am, "Don Guillett" <dguille...@gmail.com> wrote:
>
>
>
>
>
> > Get a button or shape or any shape from anywhere and right click on it to
> > assign to the macro.

>
> > --
> > Don Guillett
> > Microsoft MVP Excel
> > SalesAid Software
> > dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message

>
> >news:8e582cd5-1d23-42d7-b006-(E-Mail Removed)....
> > On Feb 7, 6:12 pm, "Don Guillett" <dguille...@gmail.com> wrote:

>
> > > sub addnum()
> > > for each c in selection
> > > c.value = c.value+7
> > > next c
> > > end sub

>
> > > game time

>
> > > --
> > > Don Guillett
> > > Microsoft MVP Excel
> > > SalesAid Software
> > > dguill...@gmail.com"Swinder" <swinde...@gmail.com> wrote in message

>
> > >news:cfc61aa7-189a-428f-87b4-(E-Mail Removed)....

>
> > > >I have a very basic spreadsheet with data in it. What I want to be
> > > > able to do is add a button that a user can click which will executea
> > > > basic command of simply adding a fixed amount (like +7) to a specific
> > > > set of the data and another amount to another column of data. I
> > > > imagine this is pretty simple to do, but I can not quite figure it
> > > > out.

>
> > > > ~Thanks.

>
> > Thanks for the fast reply. I understand how to put that in VB and I
> > see where I can select cells and then run it and have it make the
> > change. Is there a way though I can make like a button or something on
> > the worksheet itself that I can simply click on to have it run this
> > without having to select the cells and then go into the VB editor
> > every time? That part I can't seem to get.

>
> Ok so I was able to create a button and I see how to edit the macro in
> it to have it do what I want. Unfortunately now when I try to actually
> click on it to run it it tells me: "Can not run the macro. The macro
> may not be available in this workbook or all macros may be disabled."
> I have it set to enable all macros.


I appreciate the offer, I just sent you an e-mail.
 
Reply With Quote
 
 
 
Reply

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel: Question _Pete_ Excel Newsgroup 1 05-29-2008 08:15 AM
excel vba question joost Excel Newsgroup 2 06-12-2007 10:52 AM
Excel Question Lavida Excel Newsgroup 2 01-07-2007 06:08 PM
excel vba question levy.pate@baesystems.com Access Newsgroup 1 12-01-2005 04:33 PM
Excel question Nocturnal Excel Newsgroup 2 07-03-2005 01:25 AM



All times are GMT. The time now is 02:03 PM.