hello
I search for way if I run the userform from any sheet should populate data on userform
now I run userform from sheet2 and should brings data from sheet1 . so far the sheet1 should be activate to poulate data otherwise doesn't show anything
here is the code
any idea guys ?
I search for way if I run the userform from any sheet should populate data on userform
now I run userform from sheet2 and should brings data from sheet1 . so far the sheet1 should be activate to poulate data otherwise doesn't show anything
here is the code
VBA Code:
Sub Due_Date()
Dim i, lastrow As Long
Application.ScreenUpdating = False
lastrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
If Cells(i, 1) - Date >= 2 And Cells(i, 4) - Date <= 20 Then
With UserForm1.ListBox1
.AddItem
.List(.ListCount - 1, 1) = Sheet1.Cells(i, 2).Text
.List(.ListCount - 1, 2) = Sheet1.Cells(i, 3).Text
.List(.ListCount - 1, 3) = Sheet1.Cells(i, 4).Text
End With
End If
Next
Application.ScreenUpdating = True
UserForm1.Show
End Sub