Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default New to Excel VBA

I am relatively new to writing macro's in Excel.

I am writing a macro to search a given range and return only the uniqu
fields. The problem that I am having is that I would like to have th
user select the range. Is there a method or a function that I can cal
that utilises the range selector that is in the formula wizard?

Thanks

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default New to Excel VBA

A bit of plagerizing from John Walkenbach's book (Excel 2002 Powe
Programming with VBA):

Code
-------------------
Sub Test()
Dim UserRange as Range
DefaultRange = Selection.Address
On Error Goto Cancelled
Set UserRange = Application.InputBox _
(Prompt:="Range to Search:", Title:="Range Search", _
Default:=DefaultRange, Type:=8)
'Add your search using UserRange as the range variable.
Cancelled:
End Su
-------------------

K

P.S. The key is to use the Application.Inputbox rather than jus
InputBox since it gives you the Type option. Type 8 is a range.


--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"