ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,730
- Office Version
- 2007
- Platform
- Windows
Hi,
I have the working code in use below "DATABASE CODE" & need to use it again but with a small edit.
The "DATABASE CODE" code is run from a command button on worksheet "DATABASE"
The userform opens & the user enters a customers name in TextBox1
The user then selects the command button which closes the userform, adds the customers name from Textbox1 & places it into cell A6
Inserts new row etc etc then opens another userform.
**************************
This is how i wish to use the majority of the same code.
On my worksheet called QUOTES values are entered in rows where the customers name will always be in column A
The user will select a customer & run the QUOTES CODE supplied below from a command button.
Currently ive got as far as the opening of worksheet DATABASE.
Now basically its entering the customer to the "WORKSHEET DATABASE" from the selected cell on "WORKSHEET QUOTES" without the need to open the userform & use Textbox1 etc
Then all the rest, Insert row etc etc & open the last userform.
WORKSHEET QUOTES CODE
........................................................
WORKSHEET DATABASE CODE
.............................................................
Once this is done i will look to populate the opened userform from values entered on worhseet "QUOTES"
I have the working code in use below "DATABASE CODE" & need to use it again but with a small edit.
The "DATABASE CODE" code is run from a command button on worksheet "DATABASE"
The userform opens & the user enters a customers name in TextBox1
The user then selects the command button which closes the userform, adds the customers name from Textbox1 & places it into cell A6
Inserts new row etc etc then opens another userform.
**************************
This is how i wish to use the majority of the same code.
On my worksheet called QUOTES values are entered in rows where the customers name will always be in column A
The user will select a customer & run the QUOTES CODE supplied below from a command button.
Currently ive got as far as the opening of worksheet DATABASE.
Now basically its entering the customer to the "WORKSHEET DATABASE" from the selected cell on "WORKSHEET QUOTES" without the need to open the userform & use Textbox1 etc
Then all the rest, Insert row etc etc & open the last userform.
WORKSHEET QUOTES CODE
........................................................
Code:
Private Sub SendToDatabase_Click()
Dim answer As Integer
Dim r As Long
If ActiveCell.Column = 1 Then
answer = MsgBox("SEND DETAILS TO DATABASE ? ", vbYesNo + vbInformation, "OPEN DATABASE MESSAGE")
If answer = vbYes Then
ActiveWorkbook.Sheets("DATABASE").Activate
End If
Else
MsgBox "YOU NEED TO SELECT A CUSTOMER IN COLUMN A", vbCritical, "SELECT CUSTOMER MESSAGE"
End If
End Sub
WORKSHEET DATABASE CODE
.............................................................
Code:
Private Sub DatabaseSheetTransferButton_Click()
Rows("6:6").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A6:AC6").Borders.LineStyle = xlContinuous
Range("A6:AC6").Borders.Weight = xlThin
Range("A6:AC6").Interior.ColorIndex = 6
Range("A6:AC6").RowHeight = 25
Range("$Q$6").HorizontalAlignment = xlCenter
Sheets("DATABASE").Range("B6").Select
Range("O6").NumberFormat = "$#,##0.00"
Cancel = 0
If TextBox1.Text = "" Then
Cancel = 1
MsgBox "YOU MUST ENTER A CUSTOMERS NAME", vbCritical, "DATABASE USER FORM NAME TRANSFER"
TextBox1.SetFocus
End If
If Cancel = 1 Then
Exit Sub
End If
Dim i As Long
Dim x As Long
Dim ctrl As Control
Dim lastrow As Long
With ThisWorkbook.Worksheets("DATABASE")
.Range("A6").Value = TextBox1.Text
End With
Unload DatabaseUserForm
DatabaseToSheet.Show
End Sub
Once this is done i will look to populate the opened userform from values entered on worhseet "QUOTES"