ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   enter a new value into a cell using macro in excel (https://www.excelbanter.com/excel-discussion-misc-queries/21681-enter-new-value-into-cell-using-macro-excel.html)

cath

enter a new value into a cell using macro in excel
 
I would like to use a macro to move to different cells , entering a value
into the cell before moving to the next one, can this be done?

Nick Hodge

Cath

Certainly it can be done, what are you looking for specifically?

Sub EnterDataAndMoveOn()
Dim myCell as Range
Dim x as Long
x=1
For each myCell in Selection
myCell.Value=x
x=x+1
Next myCell
End Sub

The code above will add one to each cell under a selection

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS

"cath" wrote in message
...
I would like to use a macro to move to different cells , entering a value
into the cell before moving to the next one, can this be done?




Gord Dibben

cath

Yes, it can be done.

More details please.

The value to be manually entered via user interaction?

The value to be copied from a cell?

The value is a constant?

The value is a variable?

Are the cells contiguous or randomly located?


Gord Dibben Excel MVP


On Tue, 12 Apr 2005 14:45:03 -0700, "cath"
wrote:

I would like to use a macro to move to different cells , entering a value
into the cell before moving to the next one, can this be done?




All times are GMT +1. The time now is 02:35 PM.

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