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


Dear sir,with my regards,like to thank you for your help and wonderful
solution which encouraged me to send another file asking for another
help to transfer datas from main sheet to (12) sheets being the twelve
months (without duplicates the transferred data).
Many thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring.zip |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=145|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Transfering data

I just checked to make sure duplicate invoice numbers where not copied

Sub transferdata()


With Sheets("Main")
RowCount = 5
Start = RowCount
LastRow = .Range("A" & Rows.Count).End(xlUp).Row

Do While RowCount <= LastRow
If .Range("C" & RowCount) < "" Then
Invoice = .Range("C" & RowCount)
End If
If RowCount = LastRow Or _
.Range("B" & (RowCount + 1)) Then

MyMonth = Month(.Range("B" & RowCount))
With Sheets(MyMonth)
Set c = .Columns("C").Find(what:=Invoice, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
NewRow = .Range("B" & Rows.Count).End(xlUp).Row + 1
Sheets("main").Rows(Start & ":" & RowCount).Copy _
Destination:=.Rows(NewRow)
Start = RowCount + 1
End If
End With
RowCount = RowCount + 1
End If
RowCount = RowCount + 1
Loop
End With


End Sub






"tofimoon4" wrote:


Dear sir,with my regards,like to thank you for your help and wonderful
solution which encouraged me to send another file asking for another
help to transfer datas from main sheet to (12) sheets being the twelve
months (without duplicates the transferred data).
Many thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring.zip |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=145|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Transfering data

I found some rrors. Didnt check the result very carefully the 1st time

Sub transferdata()

Dim MyMonth As String

For Each sht In Sheets
If sht.Name < "main" Then
sht.Rows("5:" & Rows.Count).Delete
End If

Next sht

With Sheets("Main")
RowCount = 5
Start = RowCount
LastRow = .Range("A" & Rows.Count).End(xlUp).Row

Do While RowCount <= LastRow
If .Range("C" & RowCount) < "" Then
Invoice = .Range("C" & RowCount)
End If
If RowCount = LastRow Or _
.Range("C" & (RowCount + 1)) < "" Then

MyMonth = Month(.Range("B" & RowCount))
With Sheets(MyMonth)
Set c = .Columns("C").Find(what:=Invoice, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
NewRow = .Range("B" & Rows.Count).End(xlUp).Row + 1
If NewRow = 4 Then
NewRow = 5
End If
Sheets("main").Rows(Start & ":" & RowCount).Copy _
Destination:=.Rows(NewRow)
Start = RowCount + 1
End If
End With

End If
RowCount = RowCount + 1
Loop
End With


End Sub







"tofimoon4" wrote:


Dear sir,with my regards,like to thank you for your help and wonderful
solution which encouraged me to send another file asking for another
help to transfer datas from main sheet to (12) sheets being the twelve
months (without duplicates the transferred data).
Many thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring.zip |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=145|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Transfering data

Sub transferdata()

Dim MyMonth As String

For Each sht In Sheets
If sht.Name < "main" Then
sht.Rows("5:" & Rows.Count).Delete
End If

Next sht

With Sheets("Main")
RowCount = 5
Start = RowCount
LastRow = .Range("A" & Rows.Count).End(xlUp).Row

Do While RowCount <= LastRow
If .Range("C" & RowCount) < "" Then
Invoice = .Range("C" & RowCount)
End If
If RowCount = LastRow Or _
.Range("C" & (RowCount + 1)) < "" Then

MyMonth = Month(.Range("B" & RowCount))
With Sheets(MyMonth)
Set c = .Columns("C").Find(what:=Invoice, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
NewRow = .Range("B" & Rows.Count).End(xlUp).Row + 1
If NewRow = 4 Then
NewRow = 5
End If
Sheets("main").Rows(Start & ":" & RowCount).Copy _
Destination:=.Rows(NewRow)
Start = RowCount + 1
End If
End With

End If
RowCount = RowCount + 1
Loop
End With


End Sub







"tofimoon4" wrote:


Dear sir,with my regards,like to thank you for your help and wonderful
solution which encouraged me to send another file asking for another
help to transfer datas from main sheet to (12) sheets being the twelve
months (without duplicates the transferred data).
Many thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring.zip |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=145|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Transfering data

Should do it. Even adjusts for the fact that you did not delete row 4 as
instructed before. Do NOT delete now as it will ruin the macro. Send me your
email and I'll send the file as we don't attach files where I answered in
the ms news group.

Sub filterbymonthandcopytosheets()
Application.ScreenUpdating = False
Range("b4") = 0
lr = Cells(Rows.Count, "b").End(xlUp).Row

For i = 5 To lr
Cells(i, 1).Value = Month(Cells(i, 2))
Next i

With Range("a2:i" & lr)
For i = 1 To Cells(lr, 1)
.AutoFilter Field:=1, Criteria1:=i
.Offset(2, 1).Copy
With Sheets(CStr(i)).Range("b5")
.PasteSpecial Paste:=xlPasteFormats
.PasteSpecial Paste:=xlPasteValues
End With
Next i
.AutoFilter
End With

Columns(1).ClearContents
Application.ScreenUpdating = True
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"tofimoon4" wrote in message
...

Dear sir,with my regards,like to thank you for your help and wonderful
solution which encouraged me to send another file asking for another
help to transfer datas from main sheet to (12) sheets being the twelve
months (without duplicates the transferred data).
Many thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring.zip |
|Download:
http://www.thecodecage.com/forumz/attachment.php?attachmentid=145|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile:
http://www.thecodecage.com/forumz/member.php?userid=138
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=100128




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Transfering data

Joel,
Did we read the same post?

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Joel" wrote in message
...
I found some rrors. Didnt check the result very carefully the 1st time

Sub transferdata()

Dim MyMonth As String

For Each sht In Sheets
If sht.Name < "main" Then
sht.Rows("5:" & Rows.Count).Delete
End If

Next sht

With Sheets("Main")
RowCount = 5
Start = RowCount
LastRow = .Range("A" & Rows.Count).End(xlUp).Row

Do While RowCount <= LastRow
If .Range("C" & RowCount) < "" Then
Invoice = .Range("C" & RowCount)
End If
If RowCount = LastRow Or _
.Range("C" & (RowCount + 1)) < "" Then

MyMonth = Month(.Range("B" & RowCount))
With Sheets(MyMonth)
Set c = .Columns("C").Find(what:=Invoice, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
NewRow = .Range("B" & Rows.Count).End(xlUp).Row + 1
If NewRow = 4 Then
NewRow = 5
End If
Sheets("main").Rows(Start & ":" & RowCount).Copy _
Destination:=.Rows(NewRow)
Start = RowCount + 1
End If
End With

End If
RowCount = RowCount + 1
Loop
End With


End Sub







"tofimoon4" wrote:


Dear sir,with my regards,like to thank you for your help and wonderful
solution which encouraged me to send another file asking for another
help to transfer datas from main sheet to (12) sheets being the twelve
months (without duplicates the transferred data).
Many thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring.zip |
|Download:
http://www.thecodecage.com/forumz/attachment.php?attachmentid=145|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile:
http://www.thecodecage.com/forumz/member.php?userid=138
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=100128



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transfering data


I don't understand your response...


--
donaldb36
------------------------------------------------------------------------
donaldb36's Profile: http://www.thecodecage.com/forumz/member.php?userid=143
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transfering data


Dear sir,you are hero,i am so lucky to see you on this wonderful
forum,thank you very much for help,everything is excellent.


--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128

  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transfering data


Dear sir,with my apology,i found after some expriences that the sheets
(6,7,8,10) which i coloured in yellow in attached file have a mistake.
Asking you kindly to take a look and modify.
thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring1.zip |
|Download: http://www.thecodecage.com/forumz/attachment.php?attachmentid=146|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Transfering data

Only filters if month in col J

Sub clearsheets()
For Each ws In Worksheets
If UCase(ws.Name) < "MAIN" Then ws.Rows("5:1000").ClearContents
Next
End Sub

Sub filterbymonthandcopytosheetsSAS()
Application.ScreenUpdating = False
clearsheets

Range("b4") = 0
lr = Cells(Rows.Count, "b").End(xlUp).Row

For i = 5 To lr
Cells(i, "J").Value = Month(Cells(i, 2))
Next i

With Range("a2:j" & lr)
For i = 1 To 12

If Application.CountIf(Columns("j"), i) 0 Then
.AutoFilter Field:=10, Criteria1:=i

Range(Cells(5, "b"), Cells(lr, "i")).Copy
With Sheets(CStr(i)).Range("b5")
.PasteSpecial Paste:=xlPasteFormats
.PasteSpecial Paste:=xlPasteValues

End With
End If

Next i
.AutoFilter
End With
Columns("j").ClearContents
Application.ScreenUpdating = True
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"tofimoon4" wrote in message
...

Dear sir,with my apology,i found after some expriences that the sheets
(6,7,8,10) which i coloured in yellow in attached file have a mistake.
Asking you kindly to take a look and modify.
thanks in advance.


+-------------------------------------------------------------------+
|Filename: Transferring1.zip |
|Download:
http://www.thecodecage.com/forumz/attachment.php?attachmentid=146|
+-------------------------------------------------------------------+

--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile:
http://www.thecodecage.com/forumz/member.php?userid=138
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=100128


  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Transfering data


Thank you my sir , you are genius really.


--
tofimoon4
------------------------------------------------------------------------
tofimoon4's Profile: http://www.thecodecage.com/forumz/member.php?userid=138
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=100128

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
transfering data in another column entering more sorted data Kevin - Corporate Services Excel Worksheet Functions 0 August 6th 08 09:23 PM
transfering all data. shital shah Excel Programming 2 May 4th 06 12:31 PM
Transfering Data from Several Sheets to another Adalan Excel Worksheet Functions 0 January 16th 06 05:50 PM
transfering data pisanichris[_2_] Excel Programming 1 October 15th 05 09:18 PM
Transfering dynamic data Brent M[_2_] Excel Programming 0 September 16th 04 08:40 PM


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