ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 6,146
- Office Version
- 2024
- Platform
- Windows
I have two codes on my sheet that work fine & now need to merge them & also an additional piece to be added.
Code 1 in use
I double click a customer in column A & a user form opens called MOTORCYCLEDATABASE
Code 2 in use
I select a value in column B then click a command button.
The value that was selected is entered in the cell F7 on a different sheet called MCVIN
I need them combined like so & codes for both are supplied below
The user will double click a customer in column A, example A10
** if another column is clicked show message **
** once the above is confirmed then check if the value to the right in column C is HONDA **
If the value is HONDA then
The code will copy the value in the cell, example B10 & on sheet MCVIN put into cell F7
The user form MOTORCYCLEDATABASE is now opened
If the value ISNT HONDA then just go straight to opening the user form MOTORCYCLEDATABASE,no need to copy value to sheet MCVIN
CODE 1
CODE2
Code 1 in use
I double click a customer in column A & a user form opens called MOTORCYCLEDATABASE
Code 2 in use
I select a value in column B then click a command button.
The value that was selected is entered in the cell F7 on a different sheet called MCVIN
I need them combined like so & codes for both are supplied below
The user will double click a customer in column A, example A10
** if another column is clicked show message **
** once the above is confirmed then check if the value to the right in column C is HONDA **
If the value is HONDA then
The code will copy the value in the cell, example B10 & on sheet MCVIN put into cell F7
The user form MOTORCYCLEDATABASE is now opened
If the value ISNT HONDA then just go straight to opening the user form MOTORCYCLEDATABASE,no need to copy value to sheet MCVIN
CODE 1
Rich (BB code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Column = 1 Then
If Intersect(Range("A8", Cells(Rows.Count, "A").End(xlUp)), Target) Is Nothing Then Exit Sub
Cancel = True
MotorcycleDatabase.LoadData Me, Target.Row
End If
End Sub
CODE2
Rich (BB code):
Private Sub McVin_Click()
Dim answer As Integer
Dim r As Long
If ActiveCell.Column = 2 Then
Sheets("MCVIN").Range("F7").Value = ActiveCell.Value
Else
MsgBox "YOU NEED TO SELECT A CUSTOMER IN COLUMN B", vbCritical, "SELECT CUSTOMER MESSAGE"
End If
Worksheets("MCVIN").Activate
End Sub