Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting values of a range of data
I am trying to store the values of all the data in the worksheet but I keep getting the Run-time error '1004'. Please help. Here is my code Dim RangeValues As Variant RangeValues = srcWorkBook.Worksheets(sheetName).Range("A2",Range ("A2").End(xlDown).End(xlToRight)).Value Thank you so much! -- ryu ------------------------------------------------------------------------ ryu's Profile: http://www.thecodecage.com/forumz/member.php?userid=602 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=122376 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting values of a range of data
Ryu, what is the entire range you are trying to encompass?ryu;441175 Wrote: I am trying to store the values of all the data in the worksheet but I keep getting the Run-time error '1004'. Please help. Here is my code Dim RangeValues As Variant RangeValues = srcWorkBook.Worksheets(sheetName).Range("A2",Range ("A2").End(xlDown).End(xlToRight)).Value Thank you so much! -- Simon Lloyd Regards, Simon Lloyd 'Microsoft Office Help' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=122376 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting values of a range of data
the 2nd reference to Range("A2").End... refers to the active sheet, not
necessarily srcWorkbook... Change to srcWorkBook.Worksheets(sheetName).Range("A2",srcWo rkBook.Worksheets(sheetName).Range("A2").End(xlDow n).End(xlToRight)).ValueorWith srcWorkBook.Worksheets(sheetName) RangeValues = .Range("A2",.Range("A2").End(xlDown).End(xlToRight )).Valueend With(note the "." before each range)HTHBob UmlasExcel MVP"ryu" wrote in ... I am trying to store the values of all the data in the worksheet but I keep getting the Run-time error '1004'. Please help. Here is my code Dim RangeValues As Variant RangeValues =srcWorkBook.Worksheets(sheetName).Range("A2",Ran ge("A2").End(xlDown).End(xlToRight)).Value Thank you so much! -- ryu ------------------------------------------------------------------------ ryu's Profile: http://www.thecodecage.com/forumz/member.php?userid=602 View this thread:http://www.thecodecage.com/forumz/showthread.php?t=122376 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
getting values of a range of data
using a with / end with structure can shorten it a bit:
With srcWorkbook.Worksheets(sheetname) RangeValues = .Range(.Range("A2"), _ .Range("A2").End(xlDown).End(xlToRight)).Value End With |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cond. Format Data Bars of range based on values of another range | Excel Worksheet Functions | |||
Select different data label range (as values) | Excel Programming | |||
is it possible that the data values shown on the data labels be in a duifferent range | Excel Programming | |||
Convert Data Range in to individual values | Excel Discussion (Misc queries) | |||
Condensing a data range with only a few nonzero values??? | Excel Programming |