Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Complie Error Help

Below Code BOMBS at MsgBox line with: Compile Error Sub or Function not
defined;
With the word Search highlighted --- Why?????

Sub Tester()
For Each r In Rows
If r.Hidden = True Then
MsgBox "Row " & Mid(r.Address, 2, Search(":", r.Address) - 2) & " is
hidden."
End If
Next r
End Sub

TIA


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default Complie Error Help

I think you want the INSTR function.

You could probably also use

R.Row to get the row number.

Robin Hammond
www.enhanceddatasystems.com

"JMay" wrote in message
news:xyZId.34843$jn.14460@lakeread06...
Below Code BOMBS at MsgBox line with: Compile Error Sub or Function not
defined;
With the word Search highlighted --- Why?????

Sub Tester()
For Each r In Rows
If r.Hidden = True Then
MsgBox "Row " & Mid(r.Address, 2, Search(":", r.Address) - 2) & " is
hidden."
End If
Next r
End Sub

TIA




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default Complie Error Help

If you want to use the worksheet function SEARCH, the syntax is

Application.Search

or

Application.WorksheetFunction.Search

VBA has the Instr function that may be useful to you.


On Sun, 23 Jan 2005 22:02:40 -0500, "JMay" wrote:

Below Code BOMBS at MsgBox line with: Compile Error Sub or Function not
defined;
With the word Search highlighted --- Why?????

Sub Tester()
For Each r In Rows
If r.Hidden = True Then
MsgBox "Row " & Mid(r.Address, 2, Search(":", r.Address) - 2) & " is
hidden."
End If
Next r
End Sub

TIA


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Complie Error Help

I don't think you want to loop over 65536 rows.

Sub Tester()
For Each r In ActiveSheet.UsedRange.rows
If r.Entirerow.Hidden = True Then
MsgBox "Row " & r.row & " is hidden."
End If
Next r
End Sub

As stated by others , Search is a worksheetfunction, not a VBA function.

--
Regards,
Tom Ogilvy

"JMay" wrote in message
news:xyZId.34843$jn.14460@lakeread06...
Below Code BOMBS at MsgBox line with: Compile Error Sub or Function not
defined;
With the word Search highlighted --- Why?????

Sub Tester()
For Each r In Rows
If r.Hidden = True Then
MsgBox "Row " & Mid(r.Address, 2, Search(":", r.Address) - 2) & " is
hidden."
End If
Next r
End Sub

TIA




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Complie Error Help

Thanks Tom, as usual


"Tom Ogilvy" wrote in message
...
I don't think you want to loop over 65536 rows.

Sub Tester()
For Each r In ActiveSheet.UsedRange.rows
If r.Entirerow.Hidden = True Then
MsgBox "Row " & r.row & " is hidden."
End If
Next r
End Sub

As stated by others , Search is a worksheetfunction, not a VBA function.

--
Regards,
Tom Ogilvy

"JMay" wrote in message
news:xyZId.34843$jn.14460@lakeread06...
Below Code BOMBS at MsgBox line with: Compile Error Sub or Function not
defined;
With the word Search highlighted --- Why?????

Sub Tester()
For Each r In Rows
If r.Hidden = True Then
MsgBox "Row " & Mid(r.Address, 2, Search(":", r.Address) - 2) & " is
hidden."
End If
Next r
End Sub

TIA






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
How to fix "complie error:procedures" in Excel? Cris Liu Excel Discussion (Misc queries) 4 June 27th 06 11:48 PM
complie error brian Excel Programming 2 December 13th 04 06:51 PM
Excel - Visual Basic Complie error Chad[_11_] Excel Programming 10 July 30th 04 11:32 PM
Complie Error chris huber Excel Programming 3 January 14th 04 09:57 AM
Variable produces a complie error Btinker Excel Programming 1 November 26th 03 07:53 PM


All times are GMT +1. The time now is 07:28 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"