View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Please help me in Macros

The 3 things to check
1) The code is moving data from Sheet 1 to sheet 2. the sheet names need to
be changed in the code if you are using differrent sheet names
2) The code is expecting the data to start in Row 2 of column A. It also
expects the header row with the dates to be in row 1.
3) The code doesn't expect blank rows in column A between the data. It also
expect no blank cells in Row 1 starting in column B

I put the time 3:30 in cell A1 of sheet1 with data in every row and every
column.

"Dinesh" wrote:

Its not working

"Joel" wrote:

Sub transpose_data()

ColCount = 2
Sh2RowCount = 1
With Sheets("Sheet1")
MyTime = .Range("A1")
Do While .Cells(1, ColCount) < ""
MyDate = .Cells(1, ColCount)
DayofWeek = WeekdayName(Weekday(MyDate))
RowCount = 2
Do While .Range("A" & RowCount) < ""
Task = .Range("A" & RowCount)
Amount = .Cells(RowCount, ColCount)
With Sheets("Sheet2")
.Range("A" & Sh2RowCount) = DayofWeek
.Range("B" & Sh2RowCount) = MyDate
.Range("C" & Sh2RowCount) = MyTime
.Range("D" & Sh2RowCount) = Task
.Range("E" & Sh2RowCount) = Amount
Sh2RowCount = Sh2RowCount + 1
End With
RowCount = RowCount + 1
Loop
ColCount = ColCount + 1
Loop

End With

End Sub





"Dinesh" wrote:

I am having a report like this

03:30 10 Mar 05 Mar 31 Mar
Hourly 368 369 259
Confirmed 2383 2317 1773
Cancelled( this Hr.) 38 42 47
Cancelled Total 331 413 362
Hourly Cancel in % 10% 11% 18%
Pending (this Hr.) 29 3 12
Pending total 218 164 233
Hourly pending (%) 8% 1% 5%
Homepage(visit) 50051 48747 51728
Search results(visit) 25936 24903 28373
Review Page (visit) 8731 8544 8285
Hourly Home 7109 7482 7842
Hourly Search 3694 3812 4347
Hourly Review 1224 1361 1130
Ratio of HS & HP 0.5196 0.5095 0.5543
Ratio of HR & HP 0.1722 0.1819 0.1441
Conversion(this hour) 0.0996 0.0968 0.0596
Total Conversion 0.0919 0.0930 0.0625
Review Conversion 0.3007 0.2711 0.2292

& I have this data for every hour 9:30, 10:30, 11:30 , so on. I want to make
like this.

Saturday 2-Feb 9:30AM Confirmed 117 Daily
Saturday 2-Feb 9:30AM Home Page 2336 Daily
Saturday 2-Feb 9:30AM Search 1236 Daily
Saturday 2-Feb 9:30AM Ratio 0.5291 Daily
Saturday 2-Feb 9:30AM Conversion 0.0947 Daily
Saturday 2-Feb 9:30AM Confirmed 87 Hourly
Saturday 2-Feb 9:30AM Home Page 7680 Hourly
Saturday 2-Feb 9:30AM Search 3914 Hourly
Saturday 2-Feb 9:30AM Ratio 0.509635417 Hourly
Saturday 2-Feb 9:30AM Conversion 0.0956 Hourly

Please help me is there any macro who help me.

Thanks with Regards
Dinesh