Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created a very basic macro which adds 100 onto the value of the
current cell and have assigned it as an icon on my toolbar. The macro works perfectly, however, I have to run the macro on individual cells which, if I have a large worksheet can take quite a while. Is there a way I can adjust/edit the macro so I can select a range of cells and it will adjust them all at the same time? I have extremely limited knowledge of VBA!!! Thank you very much. Louise |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try:
Sub Macro1() Dim r As Range For Each r In Selection r.Value = r.Value + 100 Next End Sub This is also a template to update, in some way, any cells you have selected. -- Gary's Student "Louise" wrote: I have created a very basic macro which adds 100 onto the value of the current cell and have assigned it as an icon on my toolbar. The macro works perfectly, however, I have to run the macro on individual cells which, if I have a large worksheet can take quite a while. Is there a way I can adjust/edit the macro so I can select a range of cells and it will adjust them all at the same time? I have extremely limited knowledge of VBA!!! Thank you very much. Louise |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
that works perfectly, thank you very much.
Louise "Gary''s Student" wrote: Try: Sub Macro1() Dim r As Range For Each r In Selection r.Value = r.Value + 100 Next End Sub This is also a template to update, in some way, any cells you have selected. -- Gary's Student "Louise" wrote: I have created a very basic macro which adds 100 onto the value of the current cell and have assigned it as an icon on my toolbar. The macro works perfectly, however, I have to run the macro on individual cells which, if I have a large worksheet can take quite a while. Is there a way I can adjust/edit the macro so I can select a range of cells and it will adjust them all at the same time? I have extremely limited knowledge of VBA!!! Thank you very much. Louise |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You are very welcome.
-- Gary''s Student "Louise" wrote: that works perfectly, thank you very much. Louise "Gary''s Student" wrote: Try: Sub Macro1() Dim r As Range For Each r In Selection r.Value = r.Value + 100 Next End Sub This is also a template to update, in some way, any cells you have selected. -- Gary's Student "Louise" wrote: I have created a very basic macro which adds 100 onto the value of the current cell and have assigned it as an icon on my toolbar. The macro works perfectly, however, I have to run the macro on individual cells which, if I have a large worksheet can take quite a while. Is there a way I can adjust/edit the macro so I can select a range of cells and it will adjust them all at the same time? I have extremely limited knowledge of VBA!!! Thank you very much. Louise |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure about the macro, so if no one else responds this may be an
alternate solution: Does the value of the cell meet a certain condition for you to add 100? If so, you may want to use two rows, such as A and B. Row A contains your value and Row B contains a formula --- example [Adds 100 if the value in the A Cell is greater than 70] Cell A1 = 50, Cell A2= 75, Cell A3=80. Cell B1= "=if(A170,a1+100,a1) The result in B1 would be 50. You can copy the cell B1 and paste it into B2 & B3 and it will adjust the formula accordingly. The following results will be: B2 = 175 and B3 = 180. You can then use the value in column B for whatever use you need. "Louise" wrote: I have created a very basic macro which adds 100 onto the value of the current cell and have assigned it as an icon on my toolbar. The macro works perfectly, however, I have to run the macro on individual cells which, if I have a large worksheet can take quite a while. Is there a way I can adjust/edit the macro so I can select a range of cells and it will adjust them all at the same time? I have extremely limited knowledge of VBA!!! Thank you very much. Louise |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to transfer contents of 'Selected' cell to alternate cell. | Excel Worksheet Functions | |||
Update cell contents based on worksheet name | Excel Discussion (Misc queries) | |||
Can I use cell contents to update footers in excel? | Excel Discussion (Misc queries) | |||
Macro to remove contents of cell and move all other contents up one row | Excel Discussion (Misc queries) | |||
Update - Include cell contents in filename automatically | Excel Programming |