Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Naming command buttons on a UserForm


Hi,
I have a UserForm named UFListSelector. On it are 8 command buttons
that I want the names to be the value of the range of cells A1:H1 on
sheet RoomItems. I'm getting a run-time error 13
type mismatched error.

Here is the Code:

Option Explicit
Private Sub cmdShowItemSelect_Click()
Dim i As Integer

UFListSelector.RefEdit1.Value = ActiveCell.Address
For i = 1 To 8
UFListSelector.Controls("CommandButton" & i).Caption = _
ActiveWorkbook.Sheets("RoomItems").Range(Columns(i ) & "1").Value
Next i

UFListSelector.Show
End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=530958

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Naming command buttons on a UserForm

ActiveWorkbook.Sheets("RoomItems").Range(Columns(i ) & "1").Value
Shouldn't this be
ActiveWorkbook.Sheets("RoomItems").cells(1,i).Valu e
?


--
HTH
Roger
Shaftesbury (UK)


"Casey" wrote in
message ...

Hi,
I have a UserForm named UFListSelector. On it are 8 command buttons
that I want the names to be the value of the range of cells A1:H1 on
sheet RoomItems. I'm getting a run-time error 13
type mismatched error.

Here is the Code:

Option Explicit
Private Sub cmdShowItemSelect_Click()
Dim i As Integer

UFListSelector.RefEdit1.Value = ActiveCell.Address
For i = 1 To 8
UFListSelector.Controls("CommandButton" & i).Caption = _
ActiveWorkbook.Sheets("RoomItems").Range(Columns(i ) & "1").Value
Next i

UFListSelector.Show
End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile:
http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=530958



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Naming command buttons on a UserForm

Try

UFListSelector.Controls("CommandButton" & i).Caption = _
ActiveWorkbook.Sheets("RoomItems").Cells(1, i).Value


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Casey" wrote in
message ...

Hi,
I have a UserForm named UFListSelector. On it are 8 command buttons
that I want the names to be the value of the range of cells A1:H1 on
sheet RoomItems. I'm getting a run-time error 13
type mismatched error.

Here is the Code:

Option Explicit
Private Sub cmdShowItemSelect_Click()
Dim i As Integer

UFListSelector.RefEdit1.Value = ActiveCell.Address
For i = 1 To 8
UFListSelector.Controls("CommandButton" & i).Caption = _
ActiveWorkbook.Sheets("RoomItems").Range(Columns(i ) & "1").Value
Next i

UFListSelector.Show
End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile:

http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=530958



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Naming command buttons on a UserForm


Roger & Bob,
"Doh!"
Thank you very much. Works now.


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=530958

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
adding userform command buttons borg Excel Programming 3 April 2nd 06 05:14 PM
Naming vba Buttons solomon_monkey[_2_] Excel Programming 3 April 19th 05 11:03 PM
Naming of MsgBox Buttons Chuckles123[_6_] Excel Programming 1 October 3rd 04 10:42 PM
Naming of MsgBox Buttons Ivan F Moala[_14_] Excel Programming 2 October 3rd 04 12:54 PM
Naming buttons in Userform on the fly Richard Excel Programming 1 May 17th 04 08:57 AM


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