I have a spreadsheet where I usually enter suppliers details. The information is always…
- User
I have a spreadsheet where I usually enter suppliers details. The information is always entered in B3 to B8. Can I have a VBA code that will do the following. As I enter data into each cell it calculates other cell as follows: B3 calculates J1 B4 calculates K1 B5 calculates L1 B6 calculates M1 B7 calculates N1 B8 calculates O1 After the last entry in B8, I want the VBA code to search down the J,K,L,M,N,O columns to row 700 to find if there is a duplicate entry. If any duplicate entry is found, it should highlight the duplicate in the Row 1 entry. If no duplicate entry is found, It will make button 2 visible and pop up a Yes No message asking, "Do you want to add the details to the Suppliers List". If I choose Yes, thenthe data in B3:B8 is added to the next available row in sheet 'Suppliers', B3 into A B4 into B B5 into C B6 into D B7 into E B8 into F After the entry it will pop up a message saying "New suppliers details added" new line "Remember to update List selection in" new line "Job Request B3"
- Assistant
- User
I already have this code in my worsheet Change event. Is there a way of incorporating it into your code so that there ano conflicts and errors: ' Unlock the worksheet ActiveSheet.Unprotect Password:="edit"
codeIf Target.CountLarge > 1 Then Exit Sub If Not Intersect(Target, Range("D4")) Is Nothing Then ' AFTER ENTERING SUPPLIER NAME 'Application.EnableEvents = False Call FindAndCopySupplierData 'Application.EnableEvents = True preventTrigger = False End If If Target.CountLarge > 1 Then Exit Sub If Not Intersect(Target, Range("A12")) Is Nothing Then ' COLUMN B FOR ISSUES 'Application.EnableEvents = False If Target.Value <> "" Then Range("E12").Value = Now 'Application.EnableEvents = True End If End If - Assistant
- User
I have an error: Wriong number of arguments or invalid property assingnment, on the line 'Call FindAndCopySupplierData'
- Assistant
Apologies for the confusion. It seems there was a mistake in incorporating your existing code. To rectify this, you need to replace the line
Call FindAndCopySupplierData(Target.Value)with the actual code forFindAndCopySupplierData. Below is an example of how you can define and implement that procedure:excelPrivate Sub FindAndCopySupplierData(ByVal supplierName As String) ' Add your code to find and copy supplier data here ' For example: ' Dim suppliersSheet As Worksheet ' Set suppliersSheet = ThisWorkbook.Sheets("Suppliers") ' Dim supplierRange As Range ' Set supplierRange = suppliersSheet.Range("A:A") ' Dim foundSupplier As Range ' Set foundSupplier = supplierRange.Find(supplierName, LookIn:=xlValues, LookAt:=xlWhole) ' If Not foundSupplier Is Nothing Then ' ' Copy supplier data to desired location ' End If End Sub - User
I have an error on this line: Range("A1:F1").Find(duplicateCell.Value).Interior.Color = RGB(255, 0, 0) ' Highlight duplicate in Row 1
- Assistant