Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy Data...propagate | Excel Discussion (Misc queries) | |||
Propagate....copy Data | Excel Discussion (Misc queries) | |||
Auto propagate formulae? | New Users to Excel | |||
Can I propagate a date from one worksheet to another | Excel Worksheet Functions | |||
Propagate Array Formula Down Column | Excel Discussion (Misc queries) |