Open useform & select customer from worksheet data in column A

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Afternoon.
I have this code in use which works fine.
I would double click a customer in column A & the userform will open & there record is then shown.

Rich (BB code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Intersect(Range("A6", Cells(Rows.Count, "A").End(xlUp)), Target) Is Nothing Then Exit Sub
    Cancel = True
    Database.LoadData Me, Target.Row
End Sub

What i would like to do is when a userform opens when opening this worksheet i can click the command button to open the customer ONLY in cell A6
So this new code will only work for customer present at the time in cell A6

I select the worksheet.
A userform opens.
I click on the command button.
The code runs, & the customers name in cell A6 has his record now loaded / shown on the opening userform.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Can you advise on my attempt please

Rich (BB code):
Private Sub OpenA6Customer_Click()
      Dim r As Range, cell As String
      Dim sh As Worksheet
      
      Set sh = Sheets("DATABASE")
      sh.Select
      Set r = Range("A6")
      If r.Value = "" Then Exit Sub
      
      Database.LoadData Me, Target.cell("A6")
End Sub
 
Upvote 0
This is my progress after some hours ha ha

Rich (BB code):
Private Sub OpenA6Customer_Click()
Unload DatabaseOpeningForm
Database.Show
End Sub

Now this is what happens.

I open my worksheet.
A userform open.
I select the correct commandbutton.
That userform then closes.
The DATABASE userform opens & the customer who is currently in cell A6 is shown on the userform with all his records to view.

This is perfect

BUT

I havent specified what cell to be the target etc this being A6 so i assume something on the sheet is doing the work.

Can we edit / apply some code so we actually add something so A6 is the cell to work with,should i need to change A6 to something else in the future.

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,870
Messages
6,122,021
Members
449,060
Latest member
LinusJE

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