Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Method Rows of Object Global Failed

I have added a command button to an excel sheet. When you click the
button a vba form appears. On the form are command buttons A - Z.
When you click on A, the following lines of code are executed

Sub cmdA_Click ()
gsLetter = "A"
GetList gsLetter
End Sub

Private Sub GetList(gsLetter as string)
Dim i as long

For i = worksheets(2).cells(Rows.count, gsLetter).End(xlUp).Row to 1
step - 1
If Cells(i, gsletter).value < " " Then
ListBox1.AddItem workshets(2).cells(i, gsLetter).Value
End If
Next

End Sub

The code goes to sheet 2 (which is hidden), goes to Column A, gets to
the last Row in Col A which has text in it and adds the value of that
cell to a List Box. I end up with a list of items in Column A from
Sheet 2 in my List Box.

This works fine when I open the xls in Excel.

However, when I open the xls via the IE browser via our Intranet, the
vba form shows, but when I click on "A" i get the following error
message
Error 1004: Method Rows of object_global failed.

Any ideas anyone please - I have been looking at this for 3 weeks now
and it's driving me nuts.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Method Rows of Object Global Failed

Hi Lynn,

For i = worksheets(2).cells(Rows.count, gsLetter).End(xlUp).Row to 1


Just a guess, but try:

For i = worksheets(2).cells(worksheets(2).Rows.count,
gsLetter).End(xlUp).Row to 1

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.ie


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Method Rows of Object Global Failed

I'm reasonably sure Stephen meant (but who knows where he is concerned
{g}):
For i = worksheets(2).cells(worksheets(2).Rows.count,
gsLetter).End(xlUp).Row to 1 STEP -1

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article , says...
Hi Lynn,

For i = worksheets(2).cells(Rows.count, gsLetter).End(xlUp).Row to 1


Just a guess, but try:

For i = worksheets(2).cells(worksheets(2).Rows.count,
gsLetter).End(xlUp).Row to 1

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.ie



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Method Rows of Object Global Failed

Hi Tushar,

STEP -1


Oops! Yes, thanks.

Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.ie


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Method Rows of Object Global Failed

Thanks to you both for your replies. I had actually tried this and it
did not work.

What I had to do in the end was refer to the workbook so I added this
Dim ws as worksheet
Set ws = Workbooks(1).Worksheets(2)

Then added my for next
For i = ws.cells(ws.rows.count, gsLetter).End(xlUp).Row to 1 Step - 1
etc
Thanks again.
LT

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Method Add of object Validation Failed - please help Shokie New Users to Excel 1 July 10th 09 01:34 PM
Method Add of object Validation Failed - please help Shokie Excel Worksheet Functions 1 July 10th 09 01:33 PM
Runime Error 1004 Method Range of Object Global Failed Mohan[_5_] Excel Programming 3 May 21st 04 03:35 PM
Method Range of object global failed Dennis Excel Programming 2 April 7th 04 03:27 PM
Method ~ of Object ~ Failed. Joan Excel Programming 5 August 26th 03 08:13 PM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"