Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Using variable for range address



If Range("h9").Value = "N" Then
Selection.AutoFilter Field:=1, Criteria1:="+"
End If

I want to be able to replace "h9" with a variable that i can change
frequently. (ie h9, j12,or whatever cell address i want to use).

I have tried ....
Dim Ant string
Ant = "h9"
If Range("Ant").Value = "N" Then
Selection.AutoFilter Field:=1, Criteria1:="+"
End If

This however does not work. I am not sure of the proper syntax to achieve
this goal.


Thanks in advance--
dr chuck
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Using variable for range address

take the quotes away from ANT - with quotes, you are referring to a
named range ANT, without you are referring to the variable - so

if range(ant).value etc

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Using variable for range address

Remove the ""

Dim Ant string
Ant = "h9"
If Range(Ant).Value = "N" Then
Selection.AutoFilter Field:=1, Criteria1:="+"
End If




--
Message posted via
http://www.officekb.com
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Using variable for range address

thanks guys .. for the immediate help

--
dr chuck


"Crowbar via OfficeKB.com" wrote:

Remove the ""

Dim Ant string
Ant = "h9"
If Range(Ant).Value = "N" Then
Selection.AutoFilter Field:=1, Criteria1:="+"
End If




--
Message posted via
http://www.officekb.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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a range address with ADDRESS function? Steve McLeod Excel Worksheet Functions 1 December 18th 08 02:02 PM
select range and put range address in variable [email protected] Excel Programming 2 January 25th 06 01:28 AM
Range Address Memory Variable Limitation MSweetG222 Excel Programming 4 December 12th 05 06:35 PM
How do you get a Selected Range address into a variable? Jack Excel Programming 5 November 20th 03 04:09 AM


All times are GMT +1. The time now is 11:17 AM.

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"