ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   vba copy number to Column as letter ' B ' (https://www.excelbanter.com/excel-programming/356378-vba-copy-number-column-letter-b.html)

smandula

vba copy number to Column as letter ' B '
 
Can anyone suggest a VBA macro in copying a number found in Column J
say,
that number for that row is 5. Copy that number to Column 'E' (which is
the
fifth column, not the number 5 but the letter ' B '. Then proceed down
to
the next row in Column J which number is 1; copy number 1,then change
to 'B' in column A. Do this until there are no more numbers in Column
J.

Background, Column J is the Bonus number in a lottery. This number
is copied to the appropriate column as 'B'. Doing this all the while in
VBA.

With thanks


Trevor Shuttleworth

vba copy number to Column as letter ' B '
 
Sub BonusNumber()
Dim cell As Range
Dim lRow As Long
Dim lColumn As Long
Application.ScreenUpdating = False
For Each cell In _
Range("J1:J" & _
Range("J65536").End(xlUp).Row)
lRow = cell.Row
lColumn = cell.Value
Cells(lRow, lColumn) = "B"
Next 'cell
Application.ScreenUpdating = True
End Sub

"smandula" wrote in message
oups.com...
Can anyone suggest a VBA macro in copying a number found in Column J
say,
that number for that row is 5. Copy that number to Column 'E' (which is
the
fifth column, not the number 5 but the letter ' B '. Then proceed down
to
the next row in Column J which number is 1; copy number 1,then change
to 'B' in column A. Do this until there are no more numbers in Column
J.

Background, Column J is the Bonus number in a lottery. This number
is copied to the appropriate column as 'B'. Doing this all the while in
VBA.

With thanks




smandula

vba copy number to Column as letter ' B '
 
Thanks a million. The code is very concise.
Works very Well.

Thanks again


Trevor Shuttleworth

vba copy number to Column as letter ' B '
 
You're very welcome. Thanks for the feedback.


"smandula" wrote in message
ups.com...
Thanks a million. The code is very concise.
Works very Well.

Thanks again





All times are GMT +1. The time now is 03:14 AM.

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