Some Basic Doubts in Excel Macro

  • Thread starter Thread starter Manu
  • Start date Start date
M

Manu

Iam a Leaner of excel macro by using the examples in this
News group because of that i get some simple but serious
doubts some times

I have some more doubts in macro CAN YOU HELP ME please!!


1) Is it possibe to activate an Userform or List Box by
hitting one Key, (in Foxpro it is ONKEY Label...")

2) while giving conditions we use
" if a = "xxx" then ....." etc .....

but how to say
"if a (isnot equal) "xxx" ......"
( other than "else" ..... Condition)

3) while giving conditions we use "if ... then ...
endif ..."statements is it possible for using one
more "if .. then.. endif"
statement in between that statement , if yes how
many "endif" we have to use at the end

PLEASE GIVE ME SOME EXAMPLES ALSO


Tks & regards
 
Hi Manu,
1) Is it possibe to activate an Userform or List Box by
hitting one Key, (in Foxpro it is ONKEY Label...")

If your sub that shows the form is called "SubThatShowsTheForm", then
this codeline will attach that sub to control-shift-s:

Application.Onkey "^+s", "SubThatShowsTheForm"
2) while giving conditions we use
" if a = "xxx" then ....." etc .....
but how to say
"if a (isnot equal) "xxx" ......"
( other than "else" ..... Condition)

3) while giving conditions we use "if ... then ...
endif ..."statements is it possible for using one
more "if .. then.. endif"
statement in between that statement , if yes how
many "endif" we have to use at the end

You can nest them:

If A=1 Then
If a=2 Then
Msgbox "A= 2"
Else
Msgbox "A is 1"
End If
Else
Msgbox "A is neither 1 nor 2"
End If

Or:

If A=1 Then
Msgbox "A is 1"
ElseIf a=2 Then
Msgbox "A= 2"
Else
Msgbox "A is neither 1 nor 2"
End If

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top