label to display multi rows and colums on a userform

P

pswanie

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top