View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
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