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):

For y = 3 To vend + 1
     If "the 1st character" = 0 and "the 2nd character" = Range("I1") Then
          Range("B" & y & ":F" & y).Copy
          "Find last row in sheet 'Selected Values'"
          "Paste in that cell"
     End If
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

Recommended Answers

All 2 Replies

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

Thanks but I already got it solved on another forum yesterday.

Jordan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.