Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

762 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