Thread: Complex problem
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
bpotter bpotter is offline
external usenet poster
 
Posts: 28
Default Complex problem

Here is my code. Now I am getting an error. (Method or Data Member not
found)

Sub problemwells()

Dim wsPDI As Worksheet
Dim wsTodays As Worksheet
Dim wsPWS As Worksheet
Dim wbProblems As Workbook
Dim wsRt105 As Worksheet

Set wsPDI = ThisWorkbook.Sheets("PDI Paste Here")
Set wsTodays = ThisWorkbook.Sheets("Today's ")
Set wsPWS = ThisWorkbook.Sheets("Problem Well Sort")

Set wbProblems = Workbooks.Open("C:\Documents and
Settings\bpotter\Desktop\Problem Well File\Problem Wells for
Routes.xls")
Set wsRt105 = wbProblems.Sheets("Route 105")

Dim iLastRow As Long
Dim iNextRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "U").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "U").Value = 50 Then
With ThisWorkbook.wsPWS
iNextRow = .Cells(Rows.Count, "A").End(xlDown).Row + 1
.Cells(iNextRow, "A").Value = Cells(i, "A").Value
.Cells(iNextRow, "B").Value = Cells(i, "D").Value
.Cells(iNextRow, "C").Value = Cells(i, "G").Value

End With
End If
Next i






End Sub