Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transfer rows with varying criteria


Hi all,

This is the second time i have to write this message (blooming interne
exploder closed on me!) Anyway, again - thanks for all the recent hel
and hope someone can sort out this little macro for me.

Below is a macro to transfer rows where a date is matched:-

Sub ARCHIVEDAILYLIST()

Dim SourceRange As Range, TargetRange As Range
Dim SearchRange As Range, LastWrittenCell As Range
Dim i, n As Integer, k As Integer, ItemToSearchFor
'--------------------------------------
' User definitions
n = 15 ' number of columns to append
Set SourceRange = [FF1]
Set TargetRange = Range("ARCHIVE!A1")
'--------------------------------------
Set SearchRange = Range(SourceRange, SourceRange.End(xlDown))
If IsEmpty(TargetRange) Then
Set LastWrittenCell = TargetRange
k = 0
Else
k = 1
If IsEmpty(TargetRange.Offset(1, 0)) Then
Set LastWrittenCell = TargetRange
Else
Set LastWrittenCell = TargetRange.End(xlDown)
End If
End If

ItemToSearchFor = [FG1] 'A cell containing the current date
If ItemToSearchFor = "" Then
Exit Sub
End If

For Each i In SearchRange
If i.Value = ItemToSearchFor Then
Range(i, i.Offset(0, n - 1)).Copy LastWrittenCell.Offset(k + j, 0)
j = j + 1
End If
Next
Sheets("ARCHIVE").Select

End Sub

This works great for the purpose but i need to now do somethin
slightly different. INstead of transferring rows where a date is th
criteria, i need to transfer rows where in one column a non null valu
appears:

DATE PRODUCT QUANTITY

A B 1
A C 2
A D
A E 3

In the above example all rows except for product "D" are transferred
Any help in adapting the above would be much appreciated. Thanks agai
for all the help.

Chri

--
chris10
-----------------------------------------------------------------------
chris100's Profile: http://www.excelforum.com/member.php...fo&userid=2516
View this thread: http://www.excelforum.com/showthread.php?threadid=47600

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
Using macro/vba to copy varying ranges of rows BCLivell Excel Discussion (Misc queries) 3 June 6th 07 02:52 PM
Copying cells from varying rows annettek Excel Discussion (Misc queries) 2 May 25th 07 02:51 PM
SUMPRODUCT with varying # of rows Ren Excel Worksheet Functions 5 June 27th 06 11:28 PM
Varying left criteria based on 1st Letter....If Function? seve Excel Discussion (Misc queries) 2 November 25th 05 10:15 PM
Copying varying values down through rows Steve[_39_] Excel Programming 2 September 10th 03 12:10 AM


All times are GMT +1. The time now is 03:14 AM.

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

About Us

"It's about Microsoft Excel"