Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Complex problem

I am trying to create a macro that looks in column G. If the value in
colum column G is greater than or equal to 50 then I want the macro to
take certain parts of the line and puts into another workbook. I have
about 50 lines that I need it to look through and then quit. How would
I go about starting this? I am decent with macros but I am stumped on
this. Also when I add these lines into the other workbook how do I add
lines instead of just copying and paste. I would appreciate any help at
all thank you!!!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Complex problem

Sub Test()
Dim iLastRow As Long
Dim iNextRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "G").End(xlUp).Row
For i = 1 To iLastRow
If Cells(i, "G").Value = 50 Then
With Workbooks("Book2").Worksheets(1)
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
'etc.
End With
End If
Next i

End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"bpotter" wrote in message
oups.com...
I am trying to create a macro that looks in column G. If the value in
colum column G is greater than or equal to 50 then I want the macro to
take certain parts of the line and puts into another workbook. I have
about 50 lines that I need it to look through and then quit. How would
I go about starting this? I am decent with macros but I am stumped on
this. Also when I add these lines into the other workbook how do I add
lines instead of just copying and paste. I would appreciate any help at
all thank you!!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Complex problem

Thank you very much!!!! I will try that!

  #4   Report Post  
Posted to microsoft.public.excel.programming
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complex Look Up Problem CJLuke Excel Worksheet Functions 5 January 20th 07 03:03 AM
COMPLEX PROBLEM elephant Excel Discussion (Misc queries) 2 April 3rd 06 03:19 PM
Complex Problem Jedispiff Excel Worksheet Functions 4 March 3rd 06 06:44 AM
Complex Reference Problem COG Excel Programming 0 July 3rd 04 11:31 PM
Complex Match problem ServiceChris Excel Programming 3 April 27th 04 09:15 AM


All times are GMT +1. The time now is 05:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"