Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default extracting IF

Maybe something like:

Option Explicit
Sub testme99()

Dim fWks As Worksheet 'From
Dim tWks As Worksheet 'To
Dim destRow As Long
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim LastCol As Long

LastCol = 255 '= IV really the last column??

Set fWks = Workbooks("book1.xls").Worksheets("sheet1")
Set tWks = Workbooks("book2.xls").Worksheets("sheet1") 'different workbook

With tWks
destRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With

With fWks
FirstRow = 2 'header row in 1???
LastRow = .Cells(.Rows.Count, LastCol).End(xlUp).Row

For iRow = FirstRow To LastRow
If .Cells(iRow, LastCol).Value < "" Then
tWks.Cells(destRow, 1).Resize(1, LastCol).Value _
= .Cells(iRow, 1).Resize(1, LastCol).Value
destRow = destRow + 1
End If
Next iRow
End With

End Sub

martyn wrote:

If need to extract a row of information to another file or
workbook but only if the last column of that row is
populated. Im new to VBA so some sample code would be
excellent!
Many thanks


--

Dave Peterson

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
Extracting Emails f linuskmj Excel Discussion (Misc queries) 1 June 10th 08 05:30 AM
Extracting First Name Ruan New Users to Excel 12 February 15th 06 05:41 PM
extracting last name maryj Excel Worksheet Functions 4 June 29th 05 08:55 PM
extracting dd from dd/mm/yy KC Excel Worksheet Functions 4 November 27th 04 12:57 PM
extracting IF Myrna Larson[_3_] Excel Programming 0 September 26th 03 02:17 AM


All times are GMT +1. The time now is 12:44 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"