Solved

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

Posted on 2014-11-11
4
145 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now