User Profile
IlyassB320
Copper Contributor
Joined 3 years ago
User Widgets
Recent Discussions
Re: VBA code: report value in a selected column
hi mathetes, what I’m trying to achieve is reporting the missing values of columns A respective to each row in cars and customers, meaning the customer name for the orange colored rows and the inventory number for the green colored rows. As you see from the image, for every entry in “result”, it only reports the car, color and interior.1.9KViews0likes1CommentVBA code: report value in a selected column
(for clarity, see pics and code) Hi, Having these data: Table 1 in "customers" sheet Table 2 in "cars" sheet I'm able to get the matching value of each row of "customers" to "cars" in a separate sheet "results". However, I need to achieve 2 things: Reporting in column A "results" sheet, the A column value of each respective row (therefore extracting this from the individual sheets of "customers" and "cars"). Having a similar table layout with headers denoting the respective columns of results Col A= Customer/Inventory Col B= Car Col C= Color Col D= Interior I have been able to achieve up to this stage (pics) from the attached code Sub GenerateTable() Dim selectedRows As Range Set selectedRows = ThisWorkbook.Sheets("customers").Range("B2:D9") Dim resultSheet As Worksheet On Error Resume Next Set resultSheet = ThisWorkbook.Sheets("results") On Error GoTo 0 If resultSheet Is Nothing Then Set resultSheet = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) resultSheet.Name = "results" End If resultSheet.Cells.Clear Dim carsSheet As Worksheet Set carsSheet = ThisWorkbook.Sheets("cars") Dim carsRange As Range Set carsRange = carsSheet.Range("B2:D13") Dim rng As Range Dim row As Range Dim found As Range Dim match As Boolean Dim lastRow As Long For Each row In selectedRows.Rows match = False For Each rng In carsRange.Rows If row.Cells(1, 1) = rng.Cells(1, 1) And row.Cells(1, 2) = rng.Cells(1, 2) And row.Cells(1, 3) = rng.Cells(1, 3) Then If match = False Then lastRow = resultSheet.Cells(Rows.Count, 1).End(xlUp).row + 1 row.Copy resultSheet.Cells(lastRow, 1) match = True End If rng.Copy resultSheet.Cells(lastRow + 1, 1) lastRow = lastRow + 1 End If Next rng Next row End Sub2.1KViews0likes3CommentsCreating a button that generates a table listing entries from other sheets to match criteria
Hi, I'm looking to create a button using VBA to generate a table/or list of tables to list entries matching specific criterias. The criterias are imported from Table 1 - Sheet 1 The search space is Table 2 - Sheet 2 Table 3 (or more tables) is the result The result table should apply the criterias in Table 1 and find matching results in Table 2, all reported in a separate table. I'm including screenshots of how it would look like for the first few entries. If no match to criteria, then blank.783Views0likes0Comments
Recent Blog Articles
No content to show