Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Macro - Please Help

Hi,

Please help with the below macro.

I have two tabs: Sheet1 & Sheet2

Sheet1 contains the below information:

Columns:

A B C D E

Code From To Amount Group
A1050 1/06/2007 5/06/2007 $ 50,000 ABC
B1060 1/06/2007 5/06/2007 $ 50,000 ABC
C1070 1/06/2007 5/06/2007 $ 50,000 ZZZ


I need to organise these data to Sheet2 in the below format

Columns:

A N Q S

Code Amount Group Date
A1050 $ 50,000 ABC 1/06/2007
A1050 $ 50,000 ABC 2/06/2007
A1050 $ 50,000 ABC 3/06/2007
A1050 $ 50,000 ABC 4/06/2007
A1050 $ 50,000 ABC 5/06/2007
B1060 $ 50,000 ABC 1/06/2007
B1060 $ 50,000 ABC 2/06/2007
B1060 $ 50,000 ABC 3/06/2007
B1060 $ 50,000 ABC 4/06/2007
B1060 $ 50,000 ABC 5/06/2007
C1070 $ 50,000 ZZZ 1/06/2007
C1070 $ 50,000 ZZZ 2/06/2007
C1070 $ 50,000 ZZZ 3/06/2007
C1070 $ 50,000 ZZZ 4/06/2007
C1070 $ 50,000 ZZZ 5/06/2007

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Macro - Please Help

Something like this for code on Worksheets(1).

Private Sub CommandButton1_Click()
Dim DestRange As Range
Dim Cell As Range
Dim TheDate As Date
Dim Counter As Long

Set DestRange = Worksheets(2).Range("A1")

For Each Cell In Range("B2:B4")
TheDate = CDate(Cell.Value)
Do Until TheDate CDate(Cell.Offset(0, 1).Value)
DestRange.Offset(Counter, 0).Value = Cell.Offset(0, -1).Value
DestRange.Offset(Counter, 13).Value = Cell.Offset(0, 2).Value
DestRange.Offset(Counter, 16).Value = Cell.Offset(0, 3).Value
DestRange.Offset(Counter, 18).Value = TheDate

Counter = Counter + 1
TheDate = TheDate + 1
Loop
Next

End Sub

NickHK

"missk" wrote in message
ups.com...
Hi,

Please help with the below macro.

I have two tabs: Sheet1 & Sheet2

Sheet1 contains the below information:

Columns:

A B C D E

Code From To Amount Group
A1050 1/06/2007 5/06/2007 $ 50,000 ABC
B1060 1/06/2007 5/06/2007 $ 50,000 ABC
C1070 1/06/2007 5/06/2007 $ 50,000 ZZZ


I need to organise these data to Sheet2 in the below format

Columns:

A N Q S

Code Amount Group Date
A1050 $ 50,000 ABC 1/06/2007
A1050 $ 50,000 ABC 2/06/2007
A1050 $ 50,000 ABC 3/06/2007
A1050 $ 50,000 ABC 4/06/2007
A1050 $ 50,000 ABC 5/06/2007
B1060 $ 50,000 ABC 1/06/2007
B1060 $ 50,000 ABC 2/06/2007
B1060 $ 50,000 ABC 3/06/2007
B1060 $ 50,000 ABC 4/06/2007
B1060 $ 50,000 ABC 5/06/2007
C1070 $ 50,000 ZZZ 1/06/2007
C1070 $ 50,000 ZZZ 2/06/2007
C1070 $ 50,000 ZZZ 3/06/2007
C1070 $ 50,000 ZZZ 4/06/2007
C1070 $ 50,000 ZZZ 5/06/2007



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 Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 03:28 PM.

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"