ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I create a macro to add a zero to end of a cell? or cells.. (https://www.excelbanter.com/excel-programming/395714-re-how-do-i-create-macro-add-zero-end-cell-cells.html)

Mike H

How do I create a macro to add a zero to end of a cell? or cells..
 
Monica

Multiply by 10?

Sub lime()
Set myrange = Range("A1:A10")
For Each c In myrange
c.Value = c.Value * 10
Next
End Sub

Mike


"Monica" wrote:

Trying to create a macro to add a zero to the end of a cell or range of cells
-

Ie - if number is 123 it becomes 1230

Thanks


Mike H

How do I create a macro to add a zero to end of a cell? or cel
 
Monica

Sub lime()
Set myrange = Range("A1:A10")
For Each c In myrange
c.Value = CStr(c.Value) & "0"
Next
End Sub

Mike

"Monica" wrote:

Mike - Actually, do have an issue - what if they aren't all integers but
rather..

1113-456 (and you want to add a zero)

Any input you could provide would be helpful -thx!

"Mike H" wrote:

Monica

Multiply by 10?

Sub lime()
Set myrange = Range("A1:A10")
For Each c In myrange
c.Value = c.Value * 10
Next
End Sub

Mike


"Monica" wrote:

Trying to create a macro to add a zero to the end of a cell or range of cells
-

Ie - if number is 123 it becomes 1230

Thanks


Monica

How do I create a macro to add a zero to end of a cell? or cel
 
Thank you! - It worked like a charm. I truly appreciate it!.

"Mike H" wrote:

Monica

Sub lime()
Set myrange = Range("A1:A10")
For Each c In myrange
c.Value = CStr(c.Value) & "0"
Next
End Sub

Mike

"Monica" wrote:

Mike - Actually, do have an issue - what if they aren't all integers but
rather..

1113-456 (and you want to add a zero)

Any input you could provide would be helpful -thx!

"Mike H" wrote:

Monica

Multiply by 10?

Sub lime()
Set myrange = Range("A1:A10")
For Each c In myrange
c.Value = c.Value * 10
Next
End Sub

Mike


"Monica" wrote:

Trying to create a macro to add a zero to the end of a cell or range of cells
-

Ie - if number is 123 it becomes 1230

Thanks



All times are GMT +1. The time now is 01:54 AM.

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