usedrange may not start from A1:A1
On Tue, Aug 23, 2011 at 7:15 AM, shashank shekhar raj <
[email protected]> wrote:
> I modified little bit your code and it is working fine now.
>
> Here is the code :- (Only change Path of your File highlighted in Yellow)
>
> *Option Explicit
>
> Dim myexcel, mybook, mysheet, rc, userid, i, status, cle,rs
>
>
> Set myexcel=createobject("excel.application")
>
> Set mybook=myexcel.Workbooks.Open("C:\Documents and
> Settings\rajs\Desktop\kkk")
>
>
> Set mysheet=mybook.Sheets("sheet1")
>
> rc=mysheet.usedrange.rows.count
> rs=mysheet.usedrange.columns.count
> MsgBox "Total Rows are Used:-" & rc
> MsgBox "Total columns are Used:-" & rs
>
> For i= 1 to rc
> print mysheet.cells(i,"A")
> print mysheet.cells(i,"B")
> print mysheet.cells(i,"C")
>
> If mysheet.cells(i, "C") = "Created" Then
>
> i=i+1
>
>
> End If
> Next*
>
>
> On Mon, Aug 22, 2011 at 4:53 AM, uma mahesh <[email protected]>
> wrote:
> > Hello,
> >
> > I have an issue with excel sheet scripts.
> >
> > I am retriving test data from excel sheet. it is like a user creating
> > site.
> > suppose I have some 10 test data, I have used some 3 (row wise) in the
> > last coulmn created message will be created.
> >
> > Now If I run second time it will check the last coulmn if it is
> > created then it has to go to the next row. I am using the following
> > code. but
> >
> > Option Explicit
> > Dim myexcel, mybook, mysheet, rc, userid, i, status, cle
> > Set myexcel=createobject("excel.application")
> > Set mybook=myexcel.Workbooks.Open("C:\Documents and Settings\umahesh
> > \Desktop\kkk")
> > Set mysheet=mybook.Sheets("sheet1")
> > rc=mysheet.usedrange.rows.count
> > MsgBox rc
> > For i= 2 to rc
> > MsgBox mysheet.cells(i, "C")
> > MsgBox mysheet.cells(i, "A")
> > If mysheet.cells(i, "C") = "created" Then
> > i=i+1
> > cle=mysheet.cells(i, "A")
> > print cle
> > End If
> >
> > Next
> >
> > but I am not getting proper out puts. Please any one help me.
> >
> > Regards
> > Umamahesh
> > 8939192903
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> > "QTP - HP Quick Test Professional - Automated Software Testing"
> > group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> > http://groups.google.com/group/MercuryQTP?hl=en
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en