ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Compile error using Call (https://www.excelbanter.com/excel-programming/297595-compile-error-using-call.html)

Casey[_8_]

Compile error using Call
 
Thanks in advance for any help. I learn so much from all the grea
people and their ideas here, even though most of the time I'm just
silent observer, just wanted to thank all the MVP's and gurus of VB
for the education. Now the problem.

I have procedures activated by command buttons, which hide and unhid
rows meeting a certain criteria. I just show the "Hide side" becaus
the "unhide" is very similar and I'm getting the same error message o
both.

The buttons call the procedure from a module.

Private Sub CommandButton3_Click()

Call HideEmptyRows

End Sub

Here is the code from the module

Sub HideEmptyRows()
'If a particular cell within the P_L_Range was active'
'the corresponding row was hidden whether it met the criteria below o
not,'
'this was my fix to select E1500.'

Range("E1500").Select

LastRow = ActiveSheet.Range("P_L_Range").Row - 1
ActiveSheet.Range("P_L_Range").Rows.Count
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(r)) = 3 _
Then Rows(r).Select
Selection.EntireRow.Hidden = True
Next r
'Next bit of code takes user back to top of page.'
ActiveWindow.ScrollRow = 3
Range("D5").Select
End Sub

Here is the error I'm getting

Compile error:
Expected varible or procedure, not modul

--
Message posted from http://www.ExcelForum.com


kkknie[_88_]

Compile error using Call
 
I was able to duplicate this error when I put a subroutine into a modul
of the same name. What I did:

In a worksheets code:

Sub test()
Call Bubba
End sub

In a module:
Sub Bubba()
Msgbox "HI"
End Sub

All worked ok here until i went to the properties of the module an
changed its name to Bubba. I would have thought that you could no
name a subroutine the same as a module, but apparently you can...
Check if this is your problem.



--
Message posted from http://www.ExcelForum.com


Casey[_9_]

Compile error using Call
 
kkknie,
That was the problem. Thank you so much. I want to apoligize to th
forum for my inadvertant posting of my question 3 times. It wa
unintentional. Again many thanks.
Case

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com