Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Range

  Asked By: Jalal    Date: Feb 03    Category: MS Office    Views: 663
  

Can anyone tell me, how can we track active cell range using vb
code i.e. cell coloumn and rows selected.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Aiko Suzuki     Answered On: Feb 03

You can use Range.address
Sub Test()

Dim Xl as Excel.Application
Dim WB as Excel.workbook
Dim Wk as Excel.worksheet
Dim Rng as Excel.Range

Set Xl = New Excel.Application
Set Wb = xl.workbooks.open ("Workbook path")
Set Wk = Wb.activesheet
Set Rng = Wb.Range("If you have named range, you can
provide...")

Msgbox
Replace(Rng.address(Xlrowabsolute:=False),"$","")
Msgbox
Replace(Rng.address(Xlcolumnabsolute:=False),"$","")

end Sub

Not sure about the Xlrowabsolute,Xlcolumnabsolute
parameter, will let you know soon.

 
Didn't find what you were looking for? Find more on Range Or get search suggestion and latest updates.




Tagged: