View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Conditional select range

I gave you some bad code the

lr = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lr
If Cells(i, 1) = "Jen" Then
Range(Cells(i, 8), Cells(i, 11)).Select
End If
MsgBox "Cells H through K selected this row"
Next

This will work a lot better. It assumes a header row 1.


"Jen" wrote:

Hi there,

I have no VBA-knowledge whatshowever.
I was wondering if the following would be possible:

Say:
In A2:A500 I have names filled in: Bob, Jen, Tom ,....

Can I select Cells in column H:K when "Jen" is in that row?
eg.

A10 = "Jen" select range H10:K10
A67 = "Jen" select range H67:K67

and every other "row-"range when my name appears in the first Column?


(Would it be possible to match the range (A2:A500) with a name I give
in in an Inputbox? SO that I do not have to change the name every time
in the code itself?)
Hm many questions...

All help really appreciated!!
Jen