Macro to copy a value if number

G

Guest

I have a group of data that in column B contains a mixture of part numbers
for some items, and qty for others. What I'd like to be able to do is copy
IF the value in the column B cell is a number to the corresponding column A
cell. If the value in the column B cell is not a number, do nothing.
(example below)

I have another macro to delete lines with a blank in that A column.

Any ideas?

Thanks in advance,

Scott


Here is what I have now:
Item# Qty Description
1 1 Circuit Breaker Enclosure 134
TK4V1200R
ACCESSORIES SELECTED:
1 TGL6 Ground Kit
1 TNIA1200G
1 TSKG412

Here is what I would like to end up with:
Item# Qty Description
1 1 Circuit Breaker Enclosure 134
TK4V1200R
ACCESSORIES SELECTED:
1 1 TGL6 Ground Kit
1 1 TNIA1200G
1 1 TSKG412
 
R

Ron de Bruin

Hi Scott

Try this one

Sub test()
Dim cell As Range
On Error Resume Next
For Each cell In Columns("B").SpecialCells(xlCellTypeConstants, xlNumbers)
cell.Offset(0, -1).Value = cell.Value
Next
On Error GoTo 0
End Sub
 
G

Guest

Thanks! Works perfectly!




Ron de Bruin said:
Hi Scott

Try this one

Sub test()
Dim cell As Range
On Error Resume Next
For Each cell In Columns("B").SpecialCells(xlCellTypeConstants, xlNumbers)
cell.Offset(0, -1).Value = cell.Value
Next
On Error GoTo 0
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top