excel vba problems

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

1.for excel VBA programming, how to get the row value and column value of an
active cell ?

2. if XX="YYY" then XX=10, if XX="iii" then XX=8, if XX="ooo" the XX=5,
if......
-------- How to shorten the uper express ?
 
Hi
1.
msgbox activecell.row
msgbox activecell.column

2. As alternative
select case XX
"YYY":
xx=10
"iii":
xx=8
"ooo":
xx=5
...
end select
 
You need to use the correct syntax:

Select Case XX.Value
Case "YYY":
XX.Value = 10
Case "iii":
XX.Value = 8
Case "ooo":
XX.Value = 5
Case Else
XX.Value = ""
End Select
 
Hi

This is the proper syntax:

Select Case xx
Case "YYY"
xx = 10
Case "iii"
xx = 8
Case "ooo"
xx = 5
Case Else
End Select

HTH. Best wishes Harald
 
For some reason I was assuming that XX was an object variable - if not,
use Harald's syntax.
 
Back
Top