call a Macro based on intersection

NickYOW

New Member
Joined
Mar 5, 2021
Messages
24
Office Version
  1. 2010
Platform
  1. Windows
I am trying to call a macro based on a cell with cross reference to task and Position. Currently I am using
IF range("C4").value = "Add" then
call cashierwashadd
else
call cashierwashremove
end if
if range("D4").value ="Add" then
call supervisorwashadd
else
call supervisorwashremove
end if
1615569680680.png

but the Problem is if I add a Task then C4 is no longer addressed with wash and all my code would have to be change.

I need some code that say if active cell is in column(cashier) and in row(wash) then call cashierwashadd else cashierwashremove & would move with it if the case was cashier wash was to move to cell C5.

any help would be great thanks in advance.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
I would think it would be easier for us to help if you would show us some of these scripts you want to call.

Maybe explain in detail what your attempting to do.
Just saying call this or that does not help us when we do not see the script
 
Upvote 0
I would think it would be easier for us to help if you would show us some of these scripts you want to call.

Maybe explain in detail what your attempting to do.
Just saying call this or that does not help us when we do not see the script
I currently have
if range("C4").value = "Add" then
Call cashierwashadd (message box " sweep required, do you want to add", vbOkNo)
else
Call cashierwashremove (message box " employee no longer responsible")
end if
if range("C5").value = "Add" then
call cashiersweepadd (message box " do you want to add wash floor as well", vbOkNo)
else
call cashiersweepremove (message box " employee no longer responsible")

but if I add a row above wash every thing is pushed down and when select C5 I dont get cashiersweepadd, I get cashierwashadd.

I am trying to find a index match code that will check the task in column A and the position in Row 1 and than take the active cell and add or remove the right corresponding task to the position from Row 1.
 
Upvote 0
How about
VBA Code:
   If Range("C4") = "Add" Then
      Run Range("C2").Value & Range("A4").Value & "add"
   End If
 
Upvote 0
How about
VBA Code:
   If Range("C4") = "Add" Then
      Run Range("C2").Value & Range("A4").Value & "add"
   End If

I am looking to run multiple marcos based on position and tasks so I am looking for a check with a loop to grab the employee position and the task required and it will return a message with additional tasks that are required. you cant wash floor without sweep floor. I don't think it can be that easy of a line, But I can be wrong. Been doing everything the long way.
 
Upvote 0
Did you try the code I suggested for C4?
 
Upvote 0
Did you try the code I suggested for C4?
Yes, much thanks, it is on the right track thank you, instead of the cell now I would need the if the active cell = "Add" then run a range("A1:A10"). Value & Range ("A:D"). Value & "add"
 
Upvote 0
How about
VBA Code:
   If ActiveCell = "Add" Then
      Run Cells(2, ActiveCell.Column).Value & Range("A" & ActiveCell.Row).Value & "add"
   End If
 
Upvote 0
How about
VBA Code:
   If ActiveCell = "Add" Then
      Run Cells(2, ActiveCell.Column).Value & Range("A" & ActiveCell.Row).Value & "add"
   End If
we are right there but I am getting and error.
1615578396143.png

and not sure how to get the space between cashierwash and add out.

thanks for the create help
 
Upvote 0
That suggests that you have a space after "wash" in the cell, best option would be to edit the cell to get rid of the space.
 
Upvote 0

Forum statistics

Threads
1,214,780
Messages
6,121,522
Members
449,037
Latest member
tmmotairi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top