Solved

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

Posted on 2014-11-11
4
146 Views
Last Modified: 2014-11-11
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
0
Comment
Question by:gvilbis
  • 3
4 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 500 total points
ID: 40434758
upc_number = ThisWorkbook.Sheets("CDF UPC Numbers").cells(i, j).Value
0
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 500 total points
ID: 40434761
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
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 40434833
Assuming, of course, that A2 doesn't contain the address of a range. ;)
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40434854
:-)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question