I'm creating an excel macro that will help me feel up my entire table with the right description related to that specific opt.
At the start I have got a table that looks like this:
Product |OPT | DESC_EN | DESC_ITA
____________________________________________________________________
red car |a | en description opt a | NULL
white car |a | en description opt a | it description opt a
green car |a | en description opt a | NULL
red car |b | en description opt b | NULL
green car |b | en description opt b | it description opt b
red car |c | en description opt c | NULL
white car |c | en description opt c | NULL
green car |c | en description opt c | it description opt c
As you can see I'm missing some translation in the last column of the table, but as the description refers to the optional and not to the product itself,so I can take the same description from another product but with the same opt.
Example: as you can see the WHITE CAR has got the italian description for the opt a. So i can take the description from the opt a of the WHITE CAR and use it also for the opt a but for the RED CAR. The same with the GREEN CAR soo on.
In the end my table will look like this:
Product |OPT | DESC_EN | DESC_ITA
____________________________________________________________________
red car |a | en description opt a | it description opt a
white car |a | en description opt a | it description opt a
green car |a | en description opt a | it description opt a
red car |b | en description opt b | it description opt b
green car |b | en description opt b | it description opt b
red car |c | en description opt c | it description opt c
white car |c | en description opt c | it description opt c
green car |c | en description opt c | it description opt c
This is the macro that i'm creating :
Sub Test3()
Dim Var As String
Dim found As Boolean
Dim row_number As Integer
Dim col_number As Integer
Var = "NULL"
found = False
cRow = 1
cCol = 0
Range("B2").Select
Do Until IsEmpty(ActiveCell)
If Cells(cRow, 3) = Var Then
found = True
'here is where i should copy and paste the value
Exit Do
End If
ActiveCell.Offset(1, 0).Select
cRow = cRow + 1
Loop
If found = True Then
MsgBox "Value found "
Else
MsgBox "Value not found"
End IfEnd Sub
This is what I came up with in hours, for some reason I can't make a code that takes the value from the cell that has got the translation for that opt and paste it in the cell where the translation is missing for that specific opt. I've made a bool variable to check if my code gets the right value and it should so the only thing that is missing is that damn piece of code that should copy the description into the cell matches the opt from which he copied it.
Is this possible ? I'm taking the wrong path? I should use something different?