So I have a user form that has ~60 entry fields. These are spread over 7 tabs in the userform.
What is the most efficient way to copy this over to the database? Currently on the last tab I have a save button and when that is clicked it inserts a new row on the database and starts to fill it in. I was currently typing out each line where it goes and how much offset it needs. I was not sure if there was a more efficient way to code this.
Secondly,
In some of the comboboxes and text boxes I have a default description of what goes into that box. Is there a way that when the user clicks or starts typing in the box it clears that default? And if it is left blank it keeps that default?
Last,
I also want a function to click and Edit button the database sheet. That will bring up a form with a dropdown box of showing all of the data in one column so they can select the one they want, click it and then it opens the original userform so they can edit it (instead of create new).
I attached an image of what one tab of the user form looks like and a section of the VBA on how I am copying the information over(still a work in progress as you can tell by all the lines with the same name)
Private Sub Finish_Click()
'Offset(row,column)
Range("A4").EntireRow.Insert
Sheets("Projects").Range("DataStart").Offset(1, 0) = ProjectNumber
Sheets("Projects").Range("DataStart").Offset(1, 1) = ProjectName
Sheets("Projects").Range("DataStart").Offset(1, 2) = ProjectStatus
Sheets("Projects").Range("DataStart").Offset(1, 3) = ProjectArea
Sheets("Projects").Range("DataStart").Offset(1, 4) = ProjectType
Sheets("Projects").Range("DataStart").Offset(1, 5) = ProjectCM
Sheets("Projects").Range("DataStart").Offset(1, 6) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 7) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 8) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 9) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 10) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 11) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 12) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 13) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 14) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 15) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 16) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 17) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 19) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 20) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 22) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 25) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 26) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 27) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 28) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 29) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 30) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 31) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 32) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 33) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 34) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 35) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 36) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 37) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 38) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 39) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 40) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 41) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 42) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 43) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 44) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 45) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 46) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 47) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 48) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 49) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 50) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 51) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 52) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 53) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 54) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 55) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 56) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 57) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 58) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 59) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 60) = ProjectPhase
End Sub
What is the most efficient way to copy this over to the database? Currently on the last tab I have a save button and when that is clicked it inserts a new row on the database and starts to fill it in. I was currently typing out each line where it goes and how much offset it needs. I was not sure if there was a more efficient way to code this.
Secondly,
In some of the comboboxes and text boxes I have a default description of what goes into that box. Is there a way that when the user clicks or starts typing in the box it clears that default? And if it is left blank it keeps that default?
Last,
I also want a function to click and Edit button the database sheet. That will bring up a form with a dropdown box of showing all of the data in one column so they can select the one they want, click it and then it opens the original userform so they can edit it (instead of create new).
I attached an image of what one tab of the user form looks like and a section of the VBA on how I am copying the information over(still a work in progress as you can tell by all the lines with the same name)
Private Sub Finish_Click()
'Offset(row,column)
Range("A4").EntireRow.Insert
Sheets("Projects").Range("DataStart").Offset(1, 0) = ProjectNumber
Sheets("Projects").Range("DataStart").Offset(1, 1) = ProjectName
Sheets("Projects").Range("DataStart").Offset(1, 2) = ProjectStatus
Sheets("Projects").Range("DataStart").Offset(1, 3) = ProjectArea
Sheets("Projects").Range("DataStart").Offset(1, 4) = ProjectType
Sheets("Projects").Range("DataStart").Offset(1, 5) = ProjectCM
Sheets("Projects").Range("DataStart").Offset(1, 6) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 7) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 8) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 9) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 10) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 11) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 12) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 13) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 14) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 15) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 16) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 17) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 19) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 20) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 22) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 25) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 26) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 27) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 28) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 29) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 30) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 31) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 32) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 33) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 34) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 35) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 36) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 37) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 38) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 39) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 40) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 41) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 42) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 43) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 44) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 45) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 46) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 47) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 48) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 49) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 50) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 51) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 52) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 53) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 54) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 55) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 56) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 57) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 58) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 59) = ProjectPhase
Sheets("Projects").Range("DataStart").Offset(1, 60) = ProjectPhase
End Sub