Creating labels

newbie_ex

New Member
Joined
Dec 15, 2013
Messages
9
Hi everyone,
I am trying write VBA code in excel 2007. I am not able to define my problem. I am illustrating it as,
I am trying to create a different set of codes to be executed when i give reference of it, like

Dim Alpha as long
Alpha = Range("A1").value
'now here i want to give the reference that'
if alpha > 2 then
'something like goto code 1'
else: goto code 2
end if
'where'
Code1:
<<<>>>>>
and
Code2:
<<<<>>>>
end sub


Hope that you got my question
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
if code1 is a macro then you could use the call statement like
Code:
call code1[\code] and same for code2
 
Upvote 0
thank you. But it would be easier for me if you illustrate it.

Code:
Dim Alpha As Long
Alpha = Range("A1").Value
'now here i want to give the reference that'
If Alpha > 2 Then
    Call code1
Else
    Call code2
End If
 
Upvote 0

Forum statistics

Threads
1,215,737
Messages
6,126,576
Members
449,318
Latest member
Son Raphon

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