Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Propagate labels from Worksheet

I was able to VB a label to show on a user form from a worksheet.

Private Sub UserForm_Click()

With Label1
.Caption = Worksheets("Sheet1").Range("B4") '
.AutoSize = True
.WordWrap = False
.Font.Name = "Times New Roman"
.Font.Size = 14
.Font.Bold = True
End With

End Sub

How do I propagate the labels with the Range title from the worksheet (Range
B4:B7) stopping at the first encountered empty cell? Also I have to click on
the form to show the actual label before the label caption shows-up. Could I
do it instantaneously?

Thanks a lot.

Ligaya
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Propagate labels from Worksheet

You have 4 labels (label1, label2, ..., label4)?

If yes:

Option Explicit
Private Sub UserForm_Initialize()

Dim iCtr As Long
Dim myRng As Range

Set myRng = Worksheets("sheet1").Range("b4:b7")

For iCtr = 1 To 4
With Me.Controls("label" & iCtr)
If myRng(iCtr).Value = "" Then
Exit For
'or
'.Caption = ""
Else
.Caption = myRng(iCtr).Text
.AutoSize = True
.WordWrap = False
.Font.Name = "Times New Roman"
.Font.Size = 14
.Font.Bold = True
End If
End With
Next iCtr

End Sub





Ligaya wrote:

I was able to VB a label to show on a user form from a worksheet.

Private Sub UserForm_Click()

With Label1
.Caption = Worksheets("Sheet1").Range("B4") '
.AutoSize = True
.WordWrap = False
.Font.Name = "Times New Roman"
.Font.Size = 14
.Font.Bold = True
End With

End Sub

How do I propagate the labels with the Range title from the worksheet (Range
B4:B7) stopping at the first encountered empty cell? Also I have to click on
the form to show the actual label before the label caption shows-up. Could I
do it instantaneously?

Thanks a lot.

Ligaya


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default Propagate labels from Worksheet



"Dave Peterson" wrote:

You have 4 labels (label1, label2, ..., label4)?

If yes:

Option Explicit
Private Sub UserForm_Initialize()

Dim iCtr As Long
Dim myRng As Range

Set myRng = Worksheets("sheet1").Range("b4:b7")

For iCtr = 1 To 4
With Me.Controls("label" & iCtr)
If myRng(iCtr).Value = "" Then
Exit For
'or
'.Caption = ""
Else
.Caption = myRng(iCtr).Text
.AutoSize = True
.WordWrap = False
.Font.Name = "Times New Roman"
.Font.Size = 14
.Font.Bold = True
End If
End With
Next iCtr

End Sub





Ligaya wrote:

I was able to VB a label to show on a user form from a worksheet.

Private Sub UserForm_Click()

With Label1
.Caption = Worksheets("Sheet1").Range("B4") '
.AutoSize = True
.WordWrap = False
.Font.Name = "Times New Roman"
.Font.Size = 14
.Font.Bold = True
End With

End Sub

How do I propagate the labels with the Range title from the worksheet (Range
B4:B7) stopping at the first encountered empty cell? Also I have to click on
the form to show the actual label before the label caption shows-up. Could I
do it instantaneously?

Thanks a lot.

Ligaya


--

Dave Peterson


Dave,

Thanks. I'll try that approach .


Regards.

Ligaya
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
Copy Data...propagate Brandy Excel Discussion (Misc queries) 1 May 24th 10 09:30 PM
Propagate....copy Data Brandy Excel Discussion (Misc queries) 0 May 24th 10 06:28 PM
Auto propagate formulae? MikeR New Users to Excel 2 September 21st 08 11:16 PM
Can I propagate a date from one worksheet to another DJ Excel Worksheet Functions 1 April 27th 05 03:23 AM
Propagate Array Formula Down Column [email protected] Excel Discussion (Misc queries) 1 February 20th 05 07:42 AM


All times are GMT +1. The time now is 03:00 AM.

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"