Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Move data from on sheet to another based on month

Hi All,

this what i need i have the main sheet, which all the data is placed o
to, then sheets for each month, what i want is when data is placed int
the main sheet and the date is entered it copies that row into th
coresponding sheet.

so ie colum f contains the date if it is say 20/7/04 then it copie
that row into the next avaible row of the july sheet.

Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Move data from on sheet to another based on month

Hi pauluk

Try this

There is no error checking to see if there is a date in A1 or if the sheet exist

With Sheet Input as main sheet
And with 12 sheets with a name 1,2,3...................12

This example will look at the date in A1 and copy the whole row in the month sheet


Sub copy()
Dim sourceRange As Range
Dim destrange As Range
Dim Lr As Long
Dim SHname As String
SHname = Month(Sheets("Input").Range("A1").Value)
Lr = LastRow(Sheets(SHname)) + 1
Set sourceRange = Sheets("Input").Rows("1:1")
Set destrange = Sheets(SHname).Rows(Lr). _
Resize(sourceRange.Rows.Count)
destrange.Value = sourceRange.Value
End Sub


Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

--
Regards Ron de Bruin
http://www.rondebruin.nl


"pauluk " wrote in message ...
Hi All,

this what i need i have the main sheet, which all the data is placed on
to, then sheets for each month, what i want is when data is placed into
the main sheet and the date is entered it copies that row into the
coresponding sheet.

so ie colum f contains the date if it is say 20/7/04 then it copies
that row into the next avaible row of the july sheet.

Thanks


---
Message posted from http://www.ExcelForum.com/



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
How do I move daily data from one sheet to a 'yearly sheet' ClintH2007 Excel Worksheet Functions 3 September 10th 07 07:02 AM
Move data to new sheet - rename sheet based on criteria ? [email protected] Excel Discussion (Misc queries) 7 May 16th 07 10:22 PM
move rows of data seperated in a sheet to a sheet with no separat Lynn Excel Worksheet Functions 5 December 22nd 06 03:18 AM
How do I generate a new sheet based on date/week/month? Jay Excel Worksheet Functions 1 January 10th 06 08:50 AM
Macro to move data to different column based on data in another co malycom Excel Discussion (Misc queries) 3 August 2nd 05 07:07 PM


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