Open selected customer in my main database

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,731
Office Version
  1. 2007
Platform
  1. Windows
This code is 99% down apart from one issue.

The code searches for a blank cell in column P
A msgbox is shown with the first found cell & the user is asked if its the customers they are looking for.
The user in this case selects YES to this question & the customer is then selected on the worksheet of which will bew column A

The user is shown another msgbox asking do you wish to open in main database, now this is where im stuck.
Selecting YES should open the main database & the customers records shown.
The line in Red below is the point i cant figure out on how to continue.


Code is supplied below.

Rich (BB code):
Private Sub BlankInvoiceCell_Click()
    Dim myRange As Range
    Dim answer As Integer
    Set myRange = Range("Table23").ListObject.DataBodyRange
    For Each myCell In Intersect(Columns("P"), myRange) ' COLUMN WITH NO INVOICE NUMBER
    If IsEmpty(myCell) Then
      With Range("A" & myCell.Row)
        If MsgBox("EMPTY INVOICE CELL LOCATED AT ROW: " & myCell.Address(0, 0) & vbCr & vbCr & _
          "THE CUSTOMER IS : " & .Value & vbCr & vbCr & _
          "IS THIS THE CUSTOMER YOU ARE LOOKING FOR ?", vbCritical + vbYesNo, "CUSTOMER INVOICE SEARCH") = vbYes Then
          .Select
          answer = MsgBox("OPEN CUSTOMERS FILE IN MAIN DATABASE ?", vbYesNo + vbInformation, "OPEN DATABASE MESSAGE")
          If answer = vbYes Then
          Database.LoadData Sheets("DATABASE"), .Select
        Else
          Unload DatabaseSearchForm
        End If
          Exit Sub
          End If

      End With
    End If
  Next myCell
  MsgBox "THERE ARE NO BLANK INVOICE CELLS" & vbNewLine & vbNewLine & "SO THE SEARCH IS NOW COMPLETE", vbInformation, "BLANK CELL MESSAGEE"
  Range("A5").Select
End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You have found the row where there is no invoice number (myCell.Row).

So now, you have to retrieve from this row the customer ID (if there is no ID, then use the customer name) from the appropriate column (ex. Cells(myCell.Row, "B").Value) and use it to find (Range.Find()) the row from the customer database.
 
Upvote 0
Im confused by that sorry,can you just advise please what i need to write after If answer = vbYes Then

The selected cell is the customers name
 
Upvote 0

Forum statistics

Threads
1,223,881
Messages
6,175,159
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top