hello,
I've designed a macro that would copy values based on some criterias but it doesn't work as expected.
I need to do the following:
if the value in cell A2 is blank and the value in cell B2 is a number, then to copy the value of A1 in A2
for ex: 1111 12334
12356
to become:1111 12334
1111 12356
I've written a code that does this, but the only problem is that it applies the algorithm also when on cell B i have blank.
i have used the Isnumeric function to test if a value is numeric or not. i've observed that when applying this function on a blank field it returns true.
what can i do to avoid this issue?
here is the code
I've designed a macro that would copy values based on some criterias but it doesn't work as expected.
I need to do the following:
if the value in cell A2 is blank and the value in cell B2 is a number, then to copy the value of A1 in A2
for ex: 1111 12334
12356
to become:1111 12334
1111 12356
I've written a code that does this, but the only problem is that it applies the algorithm also when on cell B i have blank.
i have used the Isnumeric function to test if a value is numeric or not. i've observed that when applying this function on a blank field it returns true.
what can i do to avoid this issue?
here is the code
Code:
Sub copy_customer_name_acrros_s2()
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LR
If IsNumeric(Cells(i, 2).Value) = True And Cells(i, 1).Value = Empty Then
Cells(i, 1).Value = Cells(i - 1, 1).Value
End If
Next i
End Sub