Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent Help Needed "Re-orient data"


In column A
There are companies (Company A, Company B....)
In column B
There are dates (01/01/2006 , 01/02/2006....)

I want to re-orient data so that
In column A the company set will be repeating assingned to each
date...

it will look like that

Company A 01/01/2006
Company B 01/01/2006
Company A 01/02/2006
Company B 01/02/2006

thanks in advance...


+-------------------------------------------------------------------+
|Filename: sheet1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4758 |
+-------------------------------------------------------------------+

--
barkiny
------------------------------------------------------------------------
barkiny's Profile: http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=542032

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Urgent Help Needed "Re-orient data"

Sub ReorientData()
Dim iLastRow As Long
Dim cDates As Long
Dim i As Long, j As Long
Dim nCalculation
Dim aryDates

With Application
.ScreenUpdating = False
nCalculation = .Calculation
.Calculation = xlCalculationManual
End With

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
cDates = Cells(Rows.Count, "B").End(xlUp).Row - 1
ReDim aryDates(1 To cDates)
For i = 1 To cDates
aryDates(i) = Cells(i + 1, "B").Value
Next i
For i = iLastRow To 2 Step -1
Rows(i + 1).Resize(cDates - 1).Insert
For j = 1 To cDates
Cells(i + j - 1, "B").Value = aryDates(j)
Next j
Cells(i, "A").Resize(cDates).Value = Cells(i, "A").Value
Next i

'reset status quo
With Application
.Calculation = nCalculation
.ScreenUpdating = True
End With

End Sub


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"barkiny" wrote in
message ...

In column A
There are companies (Company A, Company B....)
In column B
There are dates (01/01/2006 , 01/02/2006....)

I want to re-orient data so that
In column A the company set will be repeating assingned to each
date...

it will look like that

Company A 01/01/2006
Company B 01/01/2006
Company A 01/02/2006
Company B 01/02/2006

thanks in advance...


+-------------------------------------------------------------------+
|Filename: sheet1.zip |
|Download: http://www.excelforum.com/attachment.php?postid=4758 |
+-------------------------------------------------------------------+

--
barkiny
------------------------------------------------------------------------
barkiny's Profile:

http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=542032



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent Help Needed "Re-orient data"


thanks for the code
but i think it repeats companies
can you change the repeating items

Not like
Company 1 date1
Company 1 date2
Company 2 date1
Company 2 date2

but like that
Company 1 date1
Company 2 date1
Company 1 date2
Company 2 date2

and is it possible to run the macro in sheet2 so that it wont overwrite
the main values

thanks alot
regards


--
barkiny
------------------------------------------------------------------------
barkiny's Profile: http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=542032

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 216
Default Urgent Help Needed "Re-orient data"

I think this is what you want

Sub ReorientData()
Dim cData As Long
Dim cDates As Long
Dim i As Long, j As Long
Dim nCalculation
Dim aryDates

With Application
.ScreenUpdating = False
nCalculation = .Calculation
.Calculation = xlCalculationManual
End With

cData = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row - 1
cDates = Sheet1.Cells(Rows.Count, "B").End(xlUp).Row - 1
ReDim aryDates(1 To cDates)
For i = 1 To cDates
aryDates(i) = Sheet1.Cells(i + 1, "B").Value
Next i
Sheet1.Range("A1:B1").Copy Sheet2.Range("A1")
For i = 1 To cDates
Sheet1.Cells(2, "A").Resize(cData).Copy Sheet2.Cells(cData * (i - 1)
+ 2, "A")
Sheet2.Cells(cData * (i - 1) + 2, "B").Resize(cData).Value =
aryDates(i)
Next i

'reset status quo
With Application
.Calculation = nCalculation
.ScreenUpdating = True
End With

End Sub

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"barkiny" wrote in
message ...

thanks for the code
but i think it repeats companies
can you change the repeating items

Not like
Company 1 date1
Company 1 date2
Company 2 date1
Company 2 date2

but like that
Company 1 date1
Company 2 date1
Company 1 date2
Company 2 date2

and is it possible to run the macro in sheet2 so that it wont overwrite
the main values

thanks alot
regards


--
barkiny
------------------------------------------------------------------------
barkiny's Profile:

http://www.excelforum.com/member.php...o&userid=20397
View this thread: http://www.excelforum.com/showthread...hreadid=542032



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Urgent Help Needed "Re-orient data"


yes, that's what i need

thank you very much

regard

--
barkin
-----------------------------------------------------------------------
barkiny's Profile: http://www.excelforum.com/member.php...fo&userid=2039
View this thread: http://www.excelforum.com/showthread.php?threadid=54203



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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Adding "New" "Insert" "Delete" into a workbook to change from data 1 to data 2 etc Bob Reynolds[_2_] Excel Programming 0 March 4th 04 08:52 PM


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