Good Day i am having some trouble with my excel spreadsheet.
I am using VBA to get info from one of our Sites Via SQL Query i have the data and all is working as should.
This Spreadsheet is not fixed when a GRV is closed then this get new data from the server VIA SQL QUERY so i need this to be Dinamic
When i press the Button (Display Open GRV's) i want to show the selected Branch(BSCDC) on my UserForm
at this moment i am displaying all the info in my UserForm.
But when i select (BSCEV) the display Button must only show (BSCEV).
Hope i gave all the info if not please let me know i am glad to help with any other Questions.
I am using VBA to get info from one of our Sites Via SQL Query i have the data and all is working as should.
This Spreadsheet is not fixed when a GRV is closed then this get new data from the server VIA SQL QUERY so i need this to be Dinamic
When i press the Button (Display Open GRV's) i want to show the selected Branch(BSCDC) on my UserForm
at this moment i am displaying all the info in my UserForm.
But when i select (BSCEV) the display Button must only show (BSCEV).
VBA Code:
Option Explicit
Sub RectangleRoundedCorners1_Click()
'populate a multi-column ListBox from a worskheet range, using AddItem method and List property
Dim counter As Long
Dim totalRows As Long
Dim r As Long
'determine total number of rows in column A
totalRows = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
counter = 0
'ListBox gets populated with all rows in column A:
Do
With UserForm1.ListBox1
counter = counter + 1
'create a new row with Additem
.AddItem Sheet1.Cells(counter, 1).Offset(1, 1).Value
'add item in 2 column of a row
.List(.ListCount - 1, 1) = Sheet1.Cells(counter, 1).Offset(1, 1).Value
'add item in 3 column of a row
.List(.ListCount - 1, 2) = Sheet1.Cells(counter, 1).Offset(1, 2).Value
'add item in 4 column of a row
.List(.ListCount - 1, 3) = Sheet1.Cells(counter, 1).Offset(1, 3).Value
'add item in 5 column of a row
.List(.ListCount - 1, 4) = Sheet1.Cells(counter, 1).Offset(1, 4).Value
'add item in 6 column of a row
.List(.ListCount - 1, 5) = Sheet1.Cells(counter, 1).Offset(1, 5).Value
'add item in 7 column of a row
.List(.ListCount - 1, 6) = Sheet1.Cells(counter, 1).Offset(1, 6).Value
End With
Loop Until counter = totalRows
UserForm1.TextBox1.Value = WorksheetFunction.Sum(Range(Range("F2"), Range("F100"))) 'Display The Total EXCL
UserForm1.TextBox2.Value = WorksheetFunction.Sum(Range(Range("G2"), Range("G100"))) 'Display The Total VAT
UserForm1.TextBox3.Value = WorksheetFunction.Sum(Range(Range("E2"), Range("E100"))) 'Display The Total Count
UserForm1.Show
End Sub
Hope i gave all the info if not please let me know i am glad to help with any other Questions.