Dear Expert,
Below is my vlookup code & now again i replacing my data to their origin cell after editing/changing. then what will be revise code. please help me.
Private Sub ComboBox1_Change()
Dim ws As Worksheet, n As Long
Set ws = Sheets("Sheet2")
If Me.ComboBox1 = "" Then
MsgBox "Please select a style name."
Exit Sub
End If
For n = 1 To 10
Me("TextBox" & n).Value = WorksheetFunction.VLookup(Me.ComboBox1.Value, ws.Range("AE:AO"), n + 1, False)
Next
End Sub
Private Sub UserForm_Initialize()
Dim rngList
Me.ComboBox1.Clear
With Sheets("Sheet2")
Set rngList = .Range("AE2:AE" & .Cells(.Rows.Count, 31).End(xlUp).Row)
If rngList.Rows.Count > 1 Then
Me.ComboBox1.List = Application.Transpose(rngList)
Else
Me.ComboBox1.AddItem rngList
End If
End With
End Sub
Bookmarks