ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Column D x 2 (https://www.excelbanter.com/excel-programming/428619-column-d-x-2-a.html)

TGalin

Column D x 2
 
Column D has numbers in random cells. Is there a code that will look through
the cells in Column D for numbers and when it finds them multiply them by 2?

Don Guillett

Column D x 2
 
Sub multiplyby()
x = InputBox("multiple value ie: 2")
On Error Resume Next
For Each c In Columns("D").SpecialCells(xlCellTypeConstants, 23)
'If IsNumeric(c) Then c.Value = c * x
c.Value = c * x
Next c
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"TGalin" wrote in message
...
Column D has numbers in random cells. Is there a code that will look
through
the cells in Column D for numbers and when it finds them multiply them by
2?



TGalin

Column D x 2
 
Thank you for your help. I'm not sure how to use this.

"Don Guillett" wrote:

Sub multiplyby()
x = InputBox("multiple value ie: 2")
On Error Resume Next
For Each c In Columns("D").SpecialCells(xlCellTypeConstants, 23)
'If IsNumeric(c) Then c.Value = c * x
c.Value = c * x
Next c
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"TGalin" wrote in message
...
Column D has numbers in random cells. Is there a code that will look
through
the cells in Column D for numbers and when it finds them multiply them by
2?




Don Guillett

Column D x 2
 

Just copy/paste into a macro module and execute from there. Make sure your
sheet is the active sheet at the time.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"TGalin" wrote in message
...
Thank you for your help. I'm not sure how to use this.

"Don Guillett" wrote:

Sub multiplyby()
x = InputBox("multiple value ie: 2")
On Error Resume Next
For Each c In Columns("D").SpecialCells(xlCellTypeConstants, 23)
'If IsNumeric(c) Then c.Value = c * x
c.Value = c * x
Next c
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"TGalin" wrote in message
...
Column D has numbers in random cells. Is there a code that will look
through
the cells in Column D for numbers and when it finds them multiply them
by
2?






All times are GMT +1. The time now is 08:29 PM.

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