
Anonymous
Not applicable
2018-01-09
04:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
VBScript: Get data from excel cell and load it into variable
I'm trying to get a value from a cell in Excel that I calculate with a formula and then load the said value into a variable, to be used further down into the macro.
I've tried with: set vAverage = XLDoc.Sheets(1).Range("B2").Value but I get an "Object required: 'XLDoc.Sheets(...).Range(...).Value' " error. Any help?
11,691 Views
1 Solution
Accepted Solutions


MVP
2018-01-09
04:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The cell-content isn't an object else just a value therefore try it with:
vAverage = XLDoc.Sheets(1).Range("B2").Value
- Marcus
3 Replies


MVP
2018-01-09
04:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The cell-content isn't an object else just a value therefore try it with:
vAverage = XLDoc.Sheets(1).Range("B2").Value
- Marcus

Anonymous
Not applicable
2018-01-09
05:08 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's it! Thanks!
11,466 Views

Anonymous
Not applicable
2018-12-28
03:10 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please help me!
I'm having the same problem.
But I do not not how to replace the "XLDOC"
What is "XLDOC" here? Is this the path where the Excel file located?
11,408 Views
