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


I'm trying to use the following code from a userform to lock up
commandbuttons on a worksheet. I get a compile error "method or data
member not found, where indicated in red. I'm sure I'm doing something
basically wrong, any help appreciated.

Cheers

Peter

If Sheet6.Range("F49") = 0 Then
If Sheet6.Range("F59").Text = Sheet6.Range("F50").Text Then
MsgBox ("Application has been successfully activated"),
vbApplicationModal, "Message"
'Unlock Boxes code goes here
Else
Sheet7.Select
Dim rng As Range
Dim i As Long
Const sAdd As String = "A100:A129"
Const NumOfButtons As Long = 30
Dim OleObj As OLEObject
Set rng = *Me.Range*(sAdd).Resize(NumOfButtons)
For i = 1 To NumOfButtons
With Me.OLEObjects("Commandbutton" & i).Object
If rng(i).Value < "" Then
..Locked = True
Else
..Locked = False
End If
End With
Next i


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...o&userid=29686
View this thread: http://www.excelforum.com/showthread...hreadid=503565

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Compile problem

this compiles, only i don't know what the asterisks mean in the line i
commented out. you need to reference sheet6 like i have it.
but i still don't know if it will actually run



If Worksheets("Sheet6").Range("F49") = 0 Then
If Worksheets("Sheet6").Range("F59").Text = _
Worksheets("Sheet6").Range("F50").Text Then
MsgBox ("Application has been successfully activated"), vbApplicationModal,
_
"Message"
'Unlock Boxes code goes here
Else
Sheet7.Select
Dim rng As Range
Dim i As Long
Const sAdd As String = "A100:A129"
Const NumOfButtons As Long = 30
Dim OleObj As OLEObject
'Set rng = *Me.Range*(sAdd).Resize(NumOfButtons)
For i = 1 To NumOfButtons
With Me.OLEObjects("Commandbutton" & i).Object
If rng(i).Value < "" Then
Locked = True

Else
Locked = False
End If
End With

Next i
End If
End If

--


Gary


"peter.thompson"
<peter.thompson.21yqny_1137810601.7468@excelforu m-nospam.com wrote in
message news:peter.thompson.21yqny_1137810601.7468@excelfo rum-nospam.com...

I'm trying to use the following code from a userform to lock up
commandbuttons on a worksheet. I get a compile error "method or data
member not found, where indicated in red. I'm sure I'm doing something
basically wrong, any help appreciated.

Cheers

Peter

If Sheet6.Range("F49") = 0 Then
If Sheet6.Range("F59").Text = Sheet6.Range("F50").Text Then
MsgBox ("Application has been successfully activated"),
vbApplicationModal, "Message"
'Unlock Boxes code goes here
Else
Sheet7.Select
Dim rng As Range
Dim i As Long
Const sAdd As String = "A100:A129"
Const NumOfButtons As Long = 30
Dim OleObj As OLEObject
Set rng = *Me.Range*(sAdd).Resize(NumOfButtons)
For i = 1 To NumOfButtons
With Me.OLEObjects("Commandbutton" & i).Object
If rng(i).Value < "" Then
Locked = True
Else
Locked = False
End If
End With
Next i


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile:
http://www.excelforum.com/member.php...o&userid=29686
View this thread: http://www.excelforum.com/showthread...hreadid=503565



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compile problem


Thanks Gary, do you mean to run the code you commented out with
asteriks around "Me.Range"

Tried it but still bombs every which way I try

Cheers Peter


--
peter.thompson
------------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...o&userid=29686
View this thread: http://www.excelforum.com/showthread...hreadid=503565

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
compile Duplatt New Users to Excel 5 March 26th 09 01:51 AM
Won't Compile GeorgeJ Excel Discussion (Misc queries) 3 July 30th 07 09:22 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
compile error problem DKY[_58_] Excel Programming 1 August 5th 05 03:36 PM


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