Selecting the first and second characters in an excel cell

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2009
Posts: 20
Reputation: JLynn is an unknown quantity at this point 
Solved Threads: 0
JLynn JLynn is offline Offline
Newbie Poster

Selecting the first and second characters in an excel cell

 
0
  #1
Oct 29th, 2009
Hello,

I am having trouble figuring out the correct syntax for a small portion of my code. I am trying to have my code search through a column and for each entry in that column copy and paste only the rows that have the following characteristics: the first character = 0 and the second character = the value in cell (1, 9) in the current worksheet.

Below is the logic I have come up with (don't worry about "y" or "vend": they have already been declared in previous code):
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. For y = 3 To vend + 1
  2. If "the 1st character" = 0 and "the 2nd character" = Range("I1") Then
  3. Range("B" & y & ":F" & y).Copy
  4. "Find last row in sheet 'Selected Values'"
  5. "Paste in that cell"
  6. End If
  7. Next y

The only part I need help with is determining the correct syntax for selecting the first and second characters in a cell. The other stuff in quotes I already know.

Thanks in advance for your help,

Jordan
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 10
Reputation: Celt.Max is an unknown quantity at this point 
Solved Threads: 4
Celt.Max Celt.Max is offline Offline
Newbie Poster
 
0
  #2
Oct 30th, 2009
Hi there...
"the 1st character" ~ Left(Range("X" & y), 1)
"the 2nd character" ~ Mid(Range("X" & y), 2, 1)

where X you can change for the letter of your column
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 20
Reputation: JLynn is an unknown quantity at this point 
Solved Threads: 0
JLynn JLynn is offline Offline
Newbie Poster
 
0
  #3
Oct 30th, 2009
Thanks but I already got it solved on another forum yesterday.

Jordan
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC