View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK[_3_] NickHK[_3_] is offline
external usenet poster
 
Posts: 415
Default Do While True "Select" problem.

Shawn
Try this:
Dim cell As Range
With Worksheets("CodeGrid")
For Each cell In .Range(.Cells(1, 1), .Cells(1, 75))
If cell.Value = Worksheets("Coding").Range("A1").Value Then
cell.EntireColumn.Copy
Destination:=Sheets("Password").Range("L1")
Exit For
End If
Next
End With

NickHK

"Shawn" ...
Below is my code. I want to be able to do this without having to Select
anything on the CodeGrid Sheet. When I select I am having to unlock the
workbook. Is there a way I can do this without having to "select"?

ActiveWorkbook.Unprotect Password:="Time"
Worksheets("CodeGrid").Visible = True
Worksheets("CodeGrid").Activate
Range("A1").Select
Do While True And ActiveCell.Column < 75
If Worksheets("Coding").Range("A1").Value = _
ActiveCell.Value Then
Exit Do
End If
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.EntireColumn.Select
Selection.Copy Destination:=Sheets("Password").Range("L1")



--
Thanks
Shawn