how do i put value in variable in VB excel 2003?

what is wrong with this line?
i would like to put the value of cell(i,j) in vairable upc_number how do i write it?

Dim upc_number
upc_number = Range(ThisWorkbook.Sheets("CDF UPC Numbers").cell(2, 1).Value)

error "Object does not support this property or method"

please advice thanks
gvilbis
gvilbisAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Phillip BurtonConnect With a Mentor Director, Practice Manager and Computing ConsultantCommented:
upc_number = ThisWorkbook.Sheets("CDF UPC Numbers").cells(i, j).Value
0
 
Phillip BurtonConnect With a Mentor Director, Practice Manager and Computing ConsultantCommented:
1. Note that it is "cells", not "cell".
2. ThisWorkbook.Sheets("CDF UPC Numbers").cells(2, 1).Value gets you the contents of cell A2. Then you want a range from a single number - that is not allowable. A range is a series of cells, e.g. A1:B2 is a range. Basically, for you are doing, you don't need it.
0
 
Rory ArchibaldCommented:
Assuming, of course, that A2 doesn't contain the address of a range. ;)
0
 
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
:-)
0
All Courses

From novice to tech pro — start learning today.