Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 313
Default Macro to create seperate lists

I have been trying to piece together what I'm after but don't seem to be able
to do it.

I have a sheet named "Monthly". What I would like to do is loop through the
rows in "Monthly" find where the date value in column K matches the value
typed into cell A1, copy that row and paste into another sheet in the
workbook (already created) called "Sub Lists", starting the pasting from cell
G4.

If it weren't getting too difficult, is it possible instead of copying the
entire row that matches the criteria in column K to only copy certain cells
in that row. For example, if K6 had a date value that match the date typed
into cell A1, instead of copying the entire row 6, only the values in
A6,C6,D6,G6,K6,I6 would be copied and pasted into the other sheet (still
starting in cell G4).

I hope I explained that ok, any help would be much appreciated.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Macro to create seperate lists

Hi

Try this:

Sub copy()
Dim TargetRange As String
Dim CopyRow As Range

Application.ScreenUpdating = False
TargetRange = "A1:Q1000"

Worksheets("Monthly").Activate
Range(TargetRange).Select
Selection.AutoFilter FIeld:=11, Criteria1:=Range("A1").Value

Set HelpSH = Worksheets.Add
Worksheets("Monthly").Activate
Selection.copy HelpSH.Range("A1")
HelpSH.Activate
Range("K2", Range("k2").End(xlDown)).Select

For Each r In Selection.Rows
Set CopyRow = Application.Union(Cells(r.Row, 1), Cells(r.Row, 3), _
Cells(r.Row, 4), Cells(r.Row, 4), Cells(r.Row, 7), _
Cells(r.Row, 11), Cells(r.Row, 9))
CopyRow.copy Destination:=Worksheets("Sub Lists").Cells(4 + off, "G")
off = off + 1
Next
With Application
.CutCopyMode = False
Selection.AutoFilter
.DisplayAlerts = False
HelpSH.Delete
.DisplayAlerts = True
.ScreenUpdating = True
End With
End Sub

Best regards,
Per

"Tony" skrev i meddelelsen
...
I have been trying to piece together what I'm after but don't seem to be
able
to do it.

I have a sheet named "Monthly". What I would like to do is loop through
the
rows in "Monthly" find where the date value in column K matches the value
typed into cell A1, copy that row and paste into another sheet in the
workbook (already created) called "Sub Lists", starting the pasting from
cell
G4.

If it weren't getting too difficult, is it possible instead of copying the
entire row that matches the criteria in column K to only copy certain
cells
in that row. For example, if K6 had a date value that match the date typed
into cell A1, instead of copying the entire row 6, only the values in
A6,C6,D6,G6,K6,I6 would be copied and pasted into the other sheet (still
starting in cell G4).

I hope I explained that ok, any help would be much appreciated.

Thanks


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
Macro to create seperate sheets Tony Excel Programming 1 December 10th 07 09:29 AM
validation lists from seperate work books Atty Excel Discussion (Misc queries) 0 March 26th 06 11:50 PM
validation lists from seperate work books paul Excel Discussion (Misc queries) 0 March 26th 06 11:46 PM
macro to create lists bfuzzeq New Users to Excel 1 June 29th 05 09:54 PM
reconising matching no's in 2 seperate lists ian123[_43_] Excel Programming 3 January 17th 04 04:48 PM


All times are GMT +1. The time now is 10:31 AM.

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"