Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
Target.Calculate
Application.ScreenUpdating = False
Application.EnableEvents = False
'Cells.RowHeight = 15
If Not Intersect(Target, Range("WRMWire")) Is Nothing Then
Range(Range("z1").Value).RowHeight = Range("z2").Value
Range("Z2") = Target.RowHeight
Range("Z1") = Target.Address
Target.RowHeight = 25
'Make current row font size 11
'Rows(1).Font.Size = 10.5
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim tb As ListObject, pth As String, crt1 As String, crt2 As String
Dim cn As ADODB.Connection, strQuery As String, rst As ADODB.Recordset, strCon As String, Header As Boolean
Set tb = Me.ListObjects("WRMWire")
If Intersect(Target, tb.ListColumns(44).DataBodyRange) Is Nothing Or 1 < Target.Cells.Count Then Exit Sub
Set cn = New ADODB.Connection
pth = ActiveWorkbook.Path
crt1 = Cells(ActiveCell.Row, 44).Value
crt2 = Cells(ActiveCell.Row, 44).Value
If IsEmpty(crt1) Or IsEmpty(crt2) Then Exit Sub
strCon = "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=" & pth & "\File Master.xls;" & _
"Extended Properties=""Excel 12.0;HDR=Yes"";"
cn.Open strCon
'strQuery = "SELECT * FROM [Master$A:M] WHERE [Party Name]='" & crt1 & "' AND [VAT number]=" & crt2 & ";"
strQuery = "SELECT * FROM [Sheet1$A:R] WHERE [Party Name]='" & crt1 & "' AND [Party Name]=" & crt1 & ";"
Set rst = New ADODB.Recordset
rst.Open strQuery, cn, adOpenStatic, adLockReadOnly, adCmdText
Dim i As Integer
rst.MoveFirst
i = 0
With ActiveSheet.ComboBox1
.Clear
Do
.AddItem
.List(i, 0) = rst![Customer Name]
.List(i, 1) = rst![VAT number]
.List(i, 2) = rst![Country]
.List(i, 3) = rst![City]
.List(i, 4) = rst![Amount 1]
.List(i, 5) = rst![Amount 2]
.List(i, 6) = rst![Amount 2]
i = i + 1
rst.MoveNext
Loop Until rst.EOF
.Activate
.DropDown
End With
rst.Close
Set rst = Nothing
Set cn = Nothing
End Sub