gkisacik
11-07-2018, 01:05 AM
Hi,
i have a database prepared where you can find added values from Column C onwards per Column A,
Column A = project numbers
Column B= project description
Column C = date
Column D = phase number
Column E = Member
Column F = Update
Column G = date
Column H= phase number
Column I =Member
Column J = Update
...
…
…
What I am trying to do is to populate listbox by searching project no listed on Column A. got basic code programme after searching on internet,
Can someone please help me with a right code?
Thanks,
Gokhan
Private Sub UserForm_Initialize()
Dim n As Integer
Dim ws As Worksheet
Set ws = Worksheets("Updates")
ws.Activate
Dim FindString As String
Dim Rng As Range
With ws.Range("A:A")
Dim LName As String
Dim LNamei As Long
For i = 3 To 100
LNamei = WorksheetFunction.VLookup(txtprojectno.Value, Worksheets("Updates"), i, False)
Next i
If LNamei = "" Or " " Then
With lbupdate
' .ColumnCount = ActiveSheet.Cells(1).CurrentRegion.Columns.Count
' .List = ActiveSheet.Cells(1).CurrentRegion.Value
.ColumnCount = 4
.AddItem
.Column(0, 0) = LNamei ' This is not working like this way unfortunately..
.Column(1, 0) = LNamei+1
.Column(2, 0) = LNamei+2
.Column(3, 0) = LNamei+3
.Column(1,0)....
End With
'With Application
'.WindowState = xlMaximized
'Zoom = Int(.Width / Me.Width * 100)
'Width = .Width
'Height = .Height
'End With
End If
End With
End Sub
i have a database prepared where you can find added values from Column C onwards per Column A,
Column A = project numbers
Column B= project description
Column C = date
Column D = phase number
Column E = Member
Column F = Update
Column G = date
Column H= phase number
Column I =Member
Column J = Update
...
…
…
What I am trying to do is to populate listbox by searching project no listed on Column A. got basic code programme after searching on internet,
Can someone please help me with a right code?
Thanks,
Gokhan
Private Sub UserForm_Initialize()
Dim n As Integer
Dim ws As Worksheet
Set ws = Worksheets("Updates")
ws.Activate
Dim FindString As String
Dim Rng As Range
With ws.Range("A:A")
Dim LName As String
Dim LNamei As Long
For i = 3 To 100
LNamei = WorksheetFunction.VLookup(txtprojectno.Value, Worksheets("Updates"), i, False)
Next i
If LNamei = "" Or " " Then
With lbupdate
' .ColumnCount = ActiveSheet.Cells(1).CurrentRegion.Columns.Count
' .List = ActiveSheet.Cells(1).CurrentRegion.Value
.ColumnCount = 4
.AddItem
.Column(0, 0) = LNamei ' This is not working like this way unfortunately..
.Column(1, 0) = LNamei+1
.Column(2, 0) = LNamei+2
.Column(3, 0) = LNamei+3
.Column(1,0)....
End With
'With Application
'.WindowState = xlMaximized
'Zoom = Int(.Width / Me.Width * 100)
'Width = .Width
'Height = .Height
'End With
End If
End With
End Sub