parmaboy79
New Member
- Joined
- Feb 7, 2018
- Messages
- 6
Hey Guys
Looking for some help as not that expereinced with VBA, i've created a consent form for clients to fill in and that data then gets recorded, there are several pages and each step is recorded step by step as to stop it all being down in one go, i found this was a quicker way to do it. What i wanted to do was when they click next on the first page i want excel to go to another sheet that just had the company logo and the words 'processing' written on it while the macro did its thing, as to stop the client pressing the next button more than once, so they knew something was happening. I put in a 'go to processing sheet' command before setting the screen up to false but it doesnt go to the processing page, it just locks the screen and records all the data and goes to the next sheet. Any help would be much apprecaited, here is the code ive written:-
Looking for some help as not that expereinced with VBA, i've created a consent form for clients to fill in and that data then gets recorded, there are several pages and each step is recorded step by step as to stop it all being down in one go, i found this was a quicker way to do it. What i wanted to do was when they click next on the first page i want excel to go to another sheet that just had the company logo and the words 'processing' written on it while the macro did its thing, as to stop the client pressing the next button more than once, so they knew something was happening. I put in a 'go to processing sheet' command before setting the screen up to false but it doesnt go to the processing page, it just locks the screen and records all the data and goes to the next sheet. Any help would be much apprecaited, here is the code ive written:-
Code:
Sub New_Client_Sheet_1_Update()
If Worksheets("new_client_details_1").Range("ba8") <= 0 Then
MsgBox " Company Marketing Information Missing!" & vbNewLine & "" & vbNewLine & " Please Fill In All Required Fields", vbInformation, " B's Aesthetics"
End If
If Worksheets("new_client_details_1").Range("bo9") <= 10 Then
MsgBox " Client Details Missing!" & vbNewLine & "" & vbNewLine & "Please Fill In All Required Fields", vbInformation, " B's Aesthetics"
End If
If Worksheets("new_client_details_1").Range("bu9") <= 4 Then
MsgBox "Emergencey Contact Information Missing!" & vbNewLine & "" & vbNewLine & " Please Fill In All Required Fields", vbInformation, " B's Aesthetics"
End If
If Worksheets("new_client_details_1").Range("bw9") >= 17 Then
ThisWorkbook.Sheets("processing").Activate
Worksheets("processing").Range("a1").Select
Application.ScreenUpdating = False
Worksheets("new_client_details_1").Unprotect
'insert new row for new client information to be inserted
Worksheets("database").Unprotect
Worksheets("database").Range("A5").EntireRow.Insert
Worksheets("database").Rows("5").RowHeight = 30
Worksheets("database").Range("g1").FormulaR1C1 = "=(R[4]C[-5])"
Worksheets("database").Range("m1").FormulaR1C1 = "=IF(R[4]C[-11]="""",0,1)"
Worksheets("database").Range("u1").FormulaR1C1 = "=IF(R[4]C="""",0,1)"
Worksheets("database").Range("ao1").FormulaR1C1 = "=IF(R[4]C="""",0,1)"
Worksheets("database").Range("bn1").FormulaR1C1 = "=IF(R[4]C="""",0,1)"
Worksheets("Database").Range("en1").FormulaR1C1 = "=IF(R[4]C="""",0,1)"
Worksheets("Database").Range("ac1").FormulaR1C1 = "=IF(R[4]C="""",0,1)"
Worksheets("Database").Range("an1").FormulaR1C1 = "=IF(R[4]C="""",0,1)"
Worksheets("Database").Range("al1").FormulaR1C1 = "=IF(AND(RC[-9]=1,RC[2]=1),1,IF(AND(RC[-9]=1,RC[2]=0),1,IF(AND(RC[-9]=0,RC[2]=1),1,IF(AND(RC[-9]=0,RC[2]=0),0))))"
Worksheets("new_client_details_1").Range("bc8:bt8").Copy
Worksheets("database").Range("b5:s5").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'clears all tickboxe
Worksheets("new_client_details_1").CheckBoxes.Value = False
'Clears Client Information
Worksheets("new_client_details_1").Range("v15:ac15,ai15:ap15,j17,l17,n17:o17,w17:ap17,j19:aa19,ai19:ap19,j21:k21,r21:aa21,af21:ap21,k23:u23,ab23:al23,v29:ac29,ai29:ap29,n31:u31,af31:ap31").ClearContents
Worksheets("new_client_details_1").Protect DrawingObjects:=True, contents:=True, Scenarios:=True
Worksheets("database").Protect DrawingObjects:=True, contents:=True, Scenarios:=True
Application.ScreenUpdating = True
If Err = 0 Then ThisWorkbook.Sheets("new_client_details_2").Activate
Worksheets("new_client_details_2").Range("o10").Activate
End If
End Sub
Last edited by a moderator: