ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   label to display multi rows and colums on a userform (https://www.excelbanter.com/excel-programming/403633-label-display-multi-rows-colums-userform.html)

pswanie

label to display multi rows and colums on a userform
 
what code would i put where to get a label (label1) to check all lines with
data in colum c then display colum c and d and e.

colum a have a discription
colum b the start date
colum c the end date

if the system can see if it ended and not display that.

a b c
special a 01/02/07 31/03/08
special b 18/11/07 22/02/08
special c 11/08/07 18/01/08

this is code that i got all ready.


Private Sub userform1_Initialize()


userform1.Label1 = Worksheets("sheet1").Range.c

End Sub

Private Sub CommandButton1_Click()

Dim lRow As Long, i As Integer
For i = 3 To 5
lRow = Cells(Rows.Count, i).End(xlUp).Row
Cells(lRow + 1, i) = Me.Controls("TextBox" & i - 2).Value
Next i
userform1.Hide
End Sub


and this is a previous attemp that worked but not on a user form

Sub Auto_Open()
Dim S As String
Dim R As Range
'<<< CHANGE SHEET AND RANGE AS REQUIRED
Set R = ThisWorkbook.Worksheets("Sheet1").Range("C1")

Do Until R.Value = vbNullString ' loop until empty cell in C
If R(1, 2).Value <= Now Then ' Start Date
If R(1, 3).Value = Now Then ' End Date
S = S & R.Text & vbCrLf
End If
End If
Set R = R(2, 1) ' move down in C
Loop

If S < vbNullString Then
MsgBox S, vbOKOnly, "Specials"
End If
End Sub



All times are GMT +1. The time now is 09:44 AM.

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