?
Solved

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

Posted on 2014-11-11
4
Medium Priority
?
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 24

Accepted Solution

by:
Phillip Burton earned 2000 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
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…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

718 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