ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering value into cell in macro (https://www.excelbanter.com/excel-programming/412722-entering-value-into-cell-macro.html)

TD

Entering value into cell in macro
 
Hi,

I've got several macrobuttons that hide rows in sheet 2 so that only certain
cells can be filled in eg Row 16 will be hidden. When this option is chosen
row 16 is not filled in and in C25 even rows C2-C20 will be summed. C16 is
still in this formula but because it is empty it doesn't add anything. At
this stage I'm not worrying about C16 getting filled in and then option to
hide it is selected - hmm trouble for later methinks-

C27 has the formula C25/10 but I thought that I could use H1 which will be a
hidden cell C25/H1. The plan was to put a value for H1 into each of the
macros which hide different rows.

I'm very much a newbie - limited to record, fiddle copy from the net so any
help appreciated
Thank you
--
TD

[email protected]

Entering value into cell in macro
 
Hi
not sure if this is all you want but

Activesheet.Range("H1").Value = 10

will put 10 in cell H1. On the sheet "MySheet"

Worksheets("MySheet").Range("H1").Value = 10

If you have a variable called MyVar in a macro which might take the
value 10 then

Dim MyVar as integer 'or double, long etc
Worksheets("MySheet").Range("H1").Value = MyVar

regards
Paul





On Jun 17, 2:06*pm, TD wrote:
Hi,

I've got several macrobuttons that hide rows in sheet 2 so that only certain
cells can be filled in eg Row 16 will be hidden. When this option is chosen
row 16 is not filled in and in C25 even rows C2-C20 will be summed. C16 is
still in this formula but because it is empty it doesn't add anything. At
this stage I'm not worrying about C16 getting filled in and then option to
hide it is selected - hmm trouble for later methinks-

C27 has the formula C25/10 but I thought that I could use H1 which will be a
hidden cell C25/H1. The plan was to put a value for H1 into each of the
macros which hide different rows.

I'm very much a newbie - limited to record, fiddle copy from the net so any
help appreciated
Thank you
--
TD



TD

Entering value into cell in macro
 
Thank you Paul :-)
--
TD


"TD" wrote:

Hi,

I've got several macrobuttons that hide rows in sheet 2 so that only certain
cells can be filled in eg Row 16 will be hidden. When this option is chosen
row 16 is not filled in and in C25 even rows C2-C20 will be summed. C16 is
still in this formula but because it is empty it doesn't add anything. At
this stage I'm not worrying about C16 getting filled in and then option to
hide it is selected - hmm trouble for later methinks-

C27 has the formula C25/10 but I thought that I could use H1 which will be a
hidden cell C25/H1. The plan was to put a value for H1 into each of the
macros which hide different rows.

I'm very much a newbie - limited to record, fiddle copy from the net so any
help appreciated
Thank you
--
TD



All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com