944,014 Members | Top Members by Rank

Ad:
Oct 29th, 2009
0

Selecting the first and second characters in an excel cell

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JLynn is offline Offline
20 posts
since Oct 2009
Oct 30th, 2009
0
Re: Selecting the first and second characters in an excel cell
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
Reputation Points: 11
Solved Threads: 4
Newbie Poster
Celt.Max is offline Offline
13 posts
since Oct 2008
Oct 30th, 2009
0
Re: Selecting the first and second characters in an excel cell
Thanks but I already got it solved on another forum yesterday.

Jordan
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JLynn is offline Offline
20 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: running batch file in vb6
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: visual basic ,Chapter 6, Programming Challenge 6: Travel Expenses, Page 408.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC