Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Referencing code outside of current sheet

Hi -
I have an enormous piece of code that consists of a bunch of loops (I
know, I know, but it works and its fast enough for me). The code is
tied to a click event of a button, but its so much code that I had to
move half of it into a module outside of the sheet. The first half
(the half inside the sheet) runs fine, but when I call the module with
the second half, I get an "Object Required" error at the line below
(the first line of code). This is just a small portion of the second
half of the code - do you know what my problem is? Obviously it
doesn't recognize the cboCategory as an object, but why? Thanks in
advance...

Sub CallHY()

<BIf cboCategory.Text = "HAIR ACCESSORIES" Then </B
'Selects A:11 in "Asian" sheet
Call SelectRange
For j = 0 To 500
If ActiveCell.Value = "HAIR ACCESSORIES" Then
'Select all cells in row up to break point
Call SelectRow
'Copy Row
Selection.Copy
'Go to first empty row in sheets results
Call DoStuffToLast
'Paste currentRow to another worksheet destination
ActiveSheet.Paste
Sheets("Asian").Select
ActiveCell.Offset(1, 0).Activate
Else: ActiveCell.Offset(1, 0).Activate
End If
Next
Call PasteCategories
'Selects K:11 in "Asian" sheet
Call SelectRange2
For i = 0 To 500
If ActiveCell.Value = "HAIR ACCESSORIES" Then
'Select all cells in row up to break point
Call SelectRow
'Copy Row
Selection.Copy
'Go to first empty row in sheets results
Call DoStuffToLast2
'Paste currentRow to another worksheet destination
ActiveSheet.Paste
Sheets("Asian").Select
ActiveCell.Offset(1, 0).Activate
Else: ActiveCell.Offset(1, 0).Activate
End If
Next
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Referencing code outside of current sheet

"nemadrias" wrote in message
oups.com...
Hi -
I have an enormous piece of code that consists of a bunch of loops (I
know, I know, but it works and its fast enough for me). The code is
tied to a click event of a button, but its so much code that I had to
move half of it into a module outside of the sheet. The first half
(the half inside the sheet) runs fine, but when I call the module with
the second half, I get an "Object Required" error at the line below
(the first line of code). This is just a small portion of the second
half of the code - do you know what my problem is? Obviously it
doesn't recognize the cboCategory as an object, but why? Thanks in
advance...


You'll need to use
sheet1.cboCategory.Text ...
or whatever the sheet name is where the button is. The sheet is the object
that's required.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Referencing code outside of current sheet

Wow - don't I feel stupid - basic instantiation. Brainfart...thanks a
ton.
Steve


ikr wrote:
"nemadrias" wrote in message
oups.com...
Hi -
I have an enormous piece of code that consists of a bunch of loops (I
know, I know, but it works and its fast enough for me). The code is
tied to a click event of a button, but its so much code that I had to
move half of it into a module outside of the sheet. The first half
(the half inside the sheet) runs fine, but when I call the module with
the second half, I get an "Object Required" error at the line below
(the first line of code). This is just a small portion of the second
half of the code - do you know what my problem is? Obviously it
doesn't recognize the cboCategory as an object, but why? Thanks in
advance...


You'll need to use
sheet1.cboCategory.Text ...
or whatever the sheet name is where the button is. The sheet is the object
that's required.


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
referencing current tab name in formula excelhurtsme Excel Discussion (Misc queries) 4 December 11th 08 08:36 PM
referencing a different tab by referencing a list in the current s Kevin Excel Worksheet Functions 3 July 6th 07 07:57 PM
referencing a sheet named in a cell then using data from that sheet gbeard Excel Worksheet Functions 4 April 15th 05 08:42 AM
Return to Current Sheet in On (sheet activate) event macro Paul Moles Excel Programming 1 March 27th 05 03:16 PM
Code for current sheet selected... Brad Excel Programming 3 March 11th 05 04:29 PM


All times are GMT +1. The time now is 05:07 AM.

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

About Us

"It's about Microsoft Excel"