Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Subscript out of range
#1
Solved: 10 Years, 9 Months ago
Hi,

I am having trouble retreiving and then updating data from an array.

Here is my problem:
I am trying to get data from a WebTable cell. The data is a date with format "6/11/10 4:35 AM". Now I will have to split this data to get the date value "6/11/10".
Since the value I have to use should be in format of mm/dd/yyyy format so for that i thought of splitting the first index and concatenating the yy value with "20". But thats when I get the error "Subscript out of range: 'sToDate'".

Here is the line of code that I am using:

Code:
sToDate = Split(Browser("ABC").Page("ABC").Frame("fraMgr").WebTable("Table").GetCellData(2, 1), " ")
sToDate(0) = Split(sToDate(0), "/")
sToDate(0,2) = "20" & sToDate(0,2)
The sToDate value is "6/11/10 4:35 AM"

I am getting error in the last line. I even tried checking the value of sToDate(0,2) element but got the same error.
When I saw the value in Watch window, it is perfectly showing me it's value as "10". Attaching screenshot for the same.

PS - My problem is not getting the date in desired format as i know that can be done using CDate function. And in fact i have already done that. But I am not able to understand why I am getting the error for above logic. So this is just to solve my curiosity Smile.


Attached Files
.doc   Array Split.doc (Size: 115.5 KB / Downloads: 91)
Reply


Messages In This Thread
Subscript out of range - by vijayendra.shukla - 06-11-2010, 04:55 PM
RE: Subscript out of range - by guin.anirban - 06-11-2010, 06:51 PM
RE: Subscript out of range - by vijayendra.shukla - 06-11-2010, 07:40 PM
RE: Subscript out of range - by jsknight1969 - 06-11-2010, 09:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to count a repeated number in number in particular range gollsrin 1 3,420 04-28-2011, 11:41 AM
Last Post: Saket

Forum Jump:


Users browsing this thread: 1 Guest(s)