Hi Everyone,
I couldn't figure out how to solve below problems. I need your advise and ideas.
My first problem is I have a worksheet similar below. What I want to do is autofill cell B(cba) based on the last value in column A(abc column). Below code works fine if I specify start range but the problem is I want it to be dynamic because it is a consolidation macro and it is going to be added new datas in colunm A and column B. What am I doing wrong ?
My second question is actually I need your ideas about it. İn above worksheet I also have a column that specify cities but because of I download this data it comes as code. For exapmle Shanghai comes as CNSHA. There is almost 60 different cities like this. What I want to do replace all of this codes with their real names. I can create another column that explains which code means which city but I don't know what to do next. Thanks in advance for your help.
I couldn't figure out how to solve below problems. I need your advise and ideas.
My first problem is I have a worksheet similar below. What I want to do is autofill cell B(cba) based on the last value in column A(abc column). Below code works fine if I specify start range but the problem is I want it to be dynamic because it is a consolidation macro and it is going to be added new datas in colunm A and column B. What am I doing wrong ?
abc | cba |
abc | |
abc | |
abc |
VBA Code:
Dim i as integer
Dim StartRow as integer
StartRow= cells(rows.count,2).end(xlup).row
Range("B"&StartRow).AutoFill Destination:=Range("B"StartRow : B" & Range("A" & Rows.Count).End(xlUp).Row)
My second question is actually I need your ideas about it. İn above worksheet I also have a column that specify cities but because of I download this data it comes as code. For exapmle Shanghai comes as CNSHA. There is almost 60 different cities like this. What I want to do replace all of this codes with their real names. I can create another column that explains which code means which city but I don't know what to do next. Thanks in advance for your help.