Conditional Ranges?
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Conditional Ranges?

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I have a text file that I am imorting into a spreadsheet.

    Dim Plate As Integer
    Plate = Range("C1")

    Occasionally the value I'm looking for ends up 2 columns to the left.
    If this happens how can I apply a conditional statement that resets the range to("A1")

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If when this happens, there is nothing in C1 then use the following code:
    Dim Plate As Integer
    If Range("c1").Value = "" Then
    Plate = Range("a1").Value
    Else: Plate = Range("c1")
    End If

    Hope this helps.
    Kind regards, Al.

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    6
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Al,
    It works like a charm. Thanks so much for your help, it pulled me from a sticky situation.
    Thanks Again
    ToddM
    On 2002-03-15 07:35, Al Chara wrote:
    If when this happens, there is nothing in C1 then use the following code:
    Dim Plate As Integer
    If Range("c1").Value = "" Then
    Plate = Range("a1").Value
    Else: Plate = Range("c1")
    End If

    Hope this helps.
    Kind regards, Al.

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com