if with Macro

john150

New Member
Joined
May 25, 2015
Messages
7
hello,

i have a problem with my excel sheet. I want to when i click to button, excel will check value of A1 and when A1=1 will make process 1, when A1=2 will make process 2, ....

Can you help me please?


Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
hello,

i have a problem with my excel sheet. I want to when i click to button, excel will check value of A1 and when A1=1 will make process 1, when A1=2 will make process 2, ....

Can you help me please?


Thanks
Welcome to the board.

Are you looking for something like this?
Code:
Sub MyProcess()
Select Case Range("A1").Value
Case 1: 'Code to do process1
Case 2: 'Code to do process2
'More of this
End Select
 
Upvote 0
Hello,
thanks for your respond very much!

On click of button check:

When value of A1=1
process this

When value of A1=2
process this

.
.
.

Thanks!
 
Upvote 0
Hello,
thanks for your respond very much!

On click of button check:

When value of A1=1
process this

When value of A1=2
process this

.
.
.

Thanks!
Care to share your thoughts on what "process this" means?
 
Upvote 0
if A1=1 take value from B1 and put it to C1 and edit value in A1 to 2
if A1=2 take value from B1 and put it to C1 and edit value in A1 to 3, and .........

Its ok?
 
Upvote 0
if A1=1 take value from B1 and put it to C1 and edit value in A1 to 2
if A1=2 take value from B1 and put it to C1 and edit value in A1 to 3, and .........

Its ok?

Two problems. (1) if the value in B1 remains the same, then the value in C1 is the same for all values in A1, so why bother to look at A1 at all? (2) Doing what you have asked for looks like an endless loop.
 
Upvote 0
or know macro choose item from list?

cFxW.png


http://ctrlv.cz/cFxW

When macro will make process, macro will select item from list. This list will set number in A1.
 
Upvote 0
no endle loop....i think that when one of condition is true, the macro will stop

By condition you mean the value in A1? If yes, how many conditions are there? If a condition is met and the macro then changes the value in A1 to another condition, doesn't that trigger the macro again and so on ...............?
 
Upvote 0

Forum statistics

Threads
1,203,673
Messages
6,056,675
Members
444,881
Latest member
Stu2407

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