GingerCoder
New Member
- Joined
- Feb 2, 2018
- Messages
- 5
I am building an application form in excel, whereas the applicant will only be able to edit unprotected cells. I have included coding so that the number of applicants, number of facilities, and number of collateral accounts can be populated to the correct spacing in the form. For example, I have included space for up to 5 applicants using the below code. If there is only one applicant, the cells allotted for the other four applicant are automatically hidden:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C7").Value = 1 Then
Rows("24:95").Select
Selection.EntireRow.Hidden = True
Range("C7").Select
ElseIf Range("C7").Value = 2 Then
Rows("24:41").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
ElseIf Range("C7").Value = 3 Then
Rows("24:59").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
ElseIf Range("C7").Value = 4 Then
Rows("24:77").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
ElseIf Range("C7").Value = 5 Then
Rows("24:95").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
End If
Within the subset of one applicant's inputs, there are multiple data validation lists; Yes/No, type of applicant (individual, business) etc. My issue is this...No matter what cell I am in, the cursor will always jump back to C7. I have tried changing the Range("7").Select to a multitude of options to see if that fixes the issue, but to no avail. I've tried the obvious Options>Advanced>After Pressing Enter. I've tried an activecell.offset, an activecell.select, keycells as values and nothing has worked. Maybe I just don't have the right format. I can either get my structural coding or the formatting coding, but not simultaneously. What am I doing wrong? Can someone give me a code...and be specific...that will simply let the cursor go to the next active cell in the worksheet after an input and not be directed back to the one single cell. I know my issue is either with that Range("C7").Select piece or there is a code that would superceded that and be applicable to all the coding throughout the worksheet and/or workbook. I have Googled this to death and am tired. Someone help!
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C7").Value = 1 Then
Rows("24:95").Select
Selection.EntireRow.Hidden = True
Range("C7").Select
ElseIf Range("C7").Value = 2 Then
Rows("24:41").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
ElseIf Range("C7").Value = 3 Then
Rows("24:59").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
ElseIf Range("C7").Value = 4 Then
Rows("24:77").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
ElseIf Range("C7").Value = 5 Then
Rows("24:95").Select
Selection.EntireRow.Hidden = False
Range("C7").Select
End If
Within the subset of one applicant's inputs, there are multiple data validation lists; Yes/No, type of applicant (individual, business) etc. My issue is this...No matter what cell I am in, the cursor will always jump back to C7. I have tried changing the Range("7").Select to a multitude of options to see if that fixes the issue, but to no avail. I've tried the obvious Options>Advanced>After Pressing Enter. I've tried an activecell.offset, an activecell.select, keycells as values and nothing has worked. Maybe I just don't have the right format. I can either get my structural coding or the formatting coding, but not simultaneously. What am I doing wrong? Can someone give me a code...and be specific...that will simply let the cursor go to the next active cell in the worksheet after an input and not be directed back to the one single cell. I know my issue is either with that Range("C7").Select piece or there is a code that would superceded that and be applicable to all the coding throughout the worksheet and/or workbook. I have Googled this to death and am tired. Someone help!