View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones[_2_] Norman Jones[_2_] is offline
external usenet poster
 
Posts: 421
Default passing column character as subroutine parameter

Hi Anand,

Try something like:

'==========
Public Sub Macro1()
Dim sCol As String

sCol = "C"
Call Macro2(sCol)

End Sub

'----------
Public Sub Macro2(sColumn As String)
Dim Rng As Range

Set Rng = ActiveSheet.Columns(sColumn)
MsgBox Rng.Address

End Sub
'<<==========



---
Regards.
Norman
"Anand" wrote in message
...
I want to pass a column character as parameter to subroutine. What
should I define it as? Also how can I use that inside subroutine?

For example, the API the subroutine should look like is as below:

formatColumn("C") - Should format column C as per defined in the
subroutine. I'm also not clear how I can use this "C" inside
subroutine to identify which column it is. I'm just requested to have
function such as this.

Any suggestions appreciated.

thanks,
Anand.