Vinodhkumar
New Member
- Joined
- Jan 9, 2013
- Messages
- 3
Hi All,
I am new to this forum. But I am happy that I have registered with this because I have learnt lot many things through this forum. You people rock!!!!! And thank you!!!!
Now I have one requirment, which is bothering me for the past 3 days. Hope you people can easily get me out of this.
How should we declare and assign a alphanumeric value to variable in Excel VBA and refer that through code? and also could you please tweak the code to finish the process I have mentioned under: Requirement.
Note:
Unique ID sheet : Holds all the Unique Ids of the values.
Sheet1: Holds 'alphanumeric' and also 'String values' in two separate columns
Sheet2: Holds 'Aplhanumeric' values in a column
My Code is like this:
sub copyIDs()
For i = 2 to 100
Id = worksheets("UniqueID").cells(i,2).value
if (worksheets("Sheet1").cells(i,2).value like Id) then
if (worksheets("Sheet2").cells(i,2).value like Id) then
worksheets("Sheet2").cells(i,3).value = worksheets("Sheet1").cells(i,2).value
end if
next
end sub
REQUIREMENT
What it should do is, from the 'Unique ID' sheet it should take the first value, check it with 'Sheet1' and 'Sheet2' value, if the ID is present then it should copy the 'Name' from Sheet1 corresponding to the alphanumeric value and should paste in sheet2 adjacent to the alphanumeric value present there.
I need your help in finishing this task. One of the challenges i faced is that 'I am not able to assign the alphanumeric value to the variable 'ID'. It always return me a blank.'
I am new to this forum. But I am happy that I have registered with this because I have learnt lot many things through this forum. You people rock!!!!! And thank you!!!!
Now I have one requirment, which is bothering me for the past 3 days. Hope you people can easily get me out of this.
How should we declare and assign a alphanumeric value to variable in Excel VBA and refer that through code? and also could you please tweak the code to finish the process I have mentioned under: Requirement.
Note:
Unique ID sheet : Holds all the Unique Ids of the values.
Sheet1: Holds 'alphanumeric' and also 'String values' in two separate columns
Sheet2: Holds 'Aplhanumeric' values in a column
My Code is like this:
sub copyIDs()
For i = 2 to 100
Id = worksheets("UniqueID").cells(i,2).value
if (worksheets("Sheet1").cells(i,2).value like Id) then
if (worksheets("Sheet2").cells(i,2).value like Id) then
worksheets("Sheet2").cells(i,3).value = worksheets("Sheet1").cells(i,2).value
end if
next
end sub
REQUIREMENT
What it should do is, from the 'Unique ID' sheet it should take the first value, check it with 'Sheet1' and 'Sheet2' value, if the ID is present then it should copy the 'Name' from Sheet1 corresponding to the alphanumeric value and should paste in sheet2 adjacent to the alphanumeric value present there.
I need your help in finishing this task. One of the challenges i faced is that 'I am not able to assign the alphanumeric value to the variable 'ID'. It always return me a blank.'