I need to run multiple automatic macros in one sheet
Closed
akts
Posts
1
Registration date
Thursday July 4, 2013
Status
Member
Last seen
July 4, 2013
-
Jul 4, 2013 at 11:42 PM
zs1986 Posts 7 Registration date Wednesday July 3, 2013 Status Member Last seen July 22, 2013 - Jul 9, 2013 at 08:15 AM
zs1986 Posts 7 Registration date Wednesday July 3, 2013 Status Member Last seen July 22, 2013 - Jul 9, 2013 at 08:15 AM
Related:
- I need to run multiple automatic macros in one sheet
- Sheet right to left in google sheet - Guide
- Windows network commands cheat sheet - Guide
- Mark sheet in excel - Guide
- Nvidia automatic driver detection tool - Guide
- How to make multiple selections in photoshop - Guide
4 responses
sgmpatnaik
Posts
52
Registration date
Tuesday April 2, 2013
Status
Member
Last seen
November 27, 2013
45
Jul 5, 2013 at 01:52 AM
Jul 5, 2013 at 01:52 AM
@akts
Hi
as a blind shot I think your code should be like this
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C10").Value = "Y" Then
Call ABC_Y
Else
If Range("C10").Value = "N" Then
Call ABC_N
Else
If Range("C15").Value = "Y" Then
Call XYZ_Y
Else
If Range("C15").Value = "N" Then
Call XYZ_N
End If
End If
End If
End If
End Sub
for your better knowledge please download the below file
https://dl.dropboxusercontent.com/u/75654703/For_akts.xlsm
Hope your problem solve with this other wise please inform us
Thanks
Patnaik
Hi
as a blind shot I think your code should be like this
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C10").Value = "Y" Then
Call ABC_Y
Else
If Range("C10").Value = "N" Then
Call ABC_N
Else
If Range("C15").Value = "Y" Then
Call XYZ_Y
Else
If Range("C15").Value = "N" Then
Call XYZ_N
End If
End If
End If
End If
End Sub
for your better knowledge please download the below file
https://dl.dropboxusercontent.com/u/75654703/For_akts.xlsm
Hope your problem solve with this other wise please inform us
Thanks
Patnaik
Thanks, using that coding allowed me to enter multiple selections throughout the worksheet.
However, there are 21 different points where within the worksheet where I need to be able to select "Y, N or N/A" and then run the relevant macro dependant upon the answer. All the 21 questions must be answered every time the worksheet is used. I am thinking it would be something like;
If Range("C10").Value = "Y" Then
Call ABC_Y
Else
If Range("C10").Value = "N" Then
Call ABC_N
Then / Next ????<----------------------------*******
If Range("C15").Value = "Y" Then
Call XYZ_Y
Else
If Range("C15").Value = "N" Then
Call XYZ_N
End If
End If
End If
End If
End Sub
but this doesn't seem to work
However, there are 21 different points where within the worksheet where I need to be able to select "Y, N or N/A" and then run the relevant macro dependant upon the answer. All the 21 questions must be answered every time the worksheet is used. I am thinking it would be something like;
If Range("C10").Value = "Y" Then
Call ABC_Y
Else
If Range("C10").Value = "N" Then
Call ABC_N
Then / Next ????<----------------------------*******
If Range("C15").Value = "Y" Then
Call XYZ_Y
Else
If Range("C15").Value = "N" Then
Call XYZ_N
End If
End If
End If
End If
End Sub
but this doesn't seem to work
sgmpatnaik
Posts
52
Registration date
Tuesday April 2, 2013
Status
Member
Last seen
November 27, 2013
45
Jul 9, 2013 at 06:58 AM
Jul 9, 2013 at 06:58 AM
HI
is it possible to upload a sample workbook with your macros
Thanks
Patnaik
is it possible to upload a sample workbook with your macros
Thanks
Patnaik
zs1986
Posts
7
Registration date
Wednesday July 3, 2013
Status
Member
Last seen
July 22, 2013
1
Jul 9, 2013 at 08:15 AM
Jul 9, 2013 at 08:15 AM
hi,
I have gone through your problem. I think you should use Target.Address instead of normal code of range that you have used.
Please use below code and change as per your requirement of calling different macros with the different conditions.
Code:
Public Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$10"
If Target = "Y" Then
MsgBox "Y"
Else
MsgBox "N"
End If
Exit Sub
Case "$C$15"
If Target = "Y" Then
MsgBox "Y"
Else
MsgBox "N"
End If
Exit Sub
Case Else
Exit Sub
End Select
End Sub
I have gone through your problem. I think you should use Target.Address instead of normal code of range that you have used.
Please use below code and change as per your requirement of calling different macros with the different conditions.
Code:
Public Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$10"
If Target = "Y" Then
MsgBox "Y"
Else
MsgBox "N"
End If
Exit Sub
Case "$C$15"
If Target = "Y" Then
MsgBox "Y"
Else
MsgBox "N"
End If
Exit Sub
Case Else
Exit Sub
End Select
End Sub