PC Review


Reply
Thread Tools Rate Thread

Creating a new column through a column sub-header

 
 
naz
Guest
Posts: n/a
 
      20th Sep 2007
I tried to look around but it seems like I can't find the right answer
for my question.

I have a data group by a header & sub-header. See example below:


****************************
A B C D << column header
Location: California << Sub-header
23 25 21 20 << Data
10 11 41 78
45 32 21 67
Total 165 << Sub-total
Location: Nevada << Sub-header
27 45 26 10 << Data
18 13 31 48
43 82 41 17
Total 75 << Sub-total
****************************

What I wanted to do is to add the subheader as a column for each line
****************************
A B C D Location <<
column header
Location: California <<
Sub-header
23 25 21 20 California <<
Data
10 11 41 78 California
45 32 21 67 California
Total 165 California <<
Sub-total
Location: Nevada << Sub-
header
27 45 26 10 Nevada << Data
18 13 31 48 Nevada
43 82 41 17 Nevada
Total 75 Nevada <<
Sub-total
****************************

This way I can use my data for better manipulation with less manual
formatting.

PLEASE HELP.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      20th Sep 2007

Sub movelocation()

RowCount = 1
Do While Cells(RowCount, "A").Value <> ""
If Cells(RowCount, "A").Value = "Location:" Then
Location = Trim(Cells(RowCount, "B").Value)
Else
If Location <> "" Then
Cells(RowCount, "E").Value = Location
End If
End If

RowCount = RowCount + 1
Loop

End Sub

"naz" wrote:

> I tried to look around but it seems like I can't find the right answer
> for my question.
>
> I have a data group by a header & sub-header. See example below:
>
>
> ****************************
> A B C D << column header
> Location: California << Sub-header
> 23 25 21 20 << Data
> 10 11 41 78
> 45 32 21 67
> Total 165 << Sub-total
> Location: Nevada << Sub-header
> 27 45 26 10 << Data
> 18 13 31 48
> 43 82 41 17
> Total 75 << Sub-total
> ****************************
>
> What I wanted to do is to add the subheader as a column for each line
> ****************************
> A B C D Location <<
> column header
> Location: California <<
> Sub-header
> 23 25 21 20 California <<
> Data
> 10 11 41 78 California
> 45 32 21 67 California
> Total 165 California <<
> Sub-total
> Location: Nevada << Sub-
> header
> 27 45 26 10 Nevada << Data
> 18 13 31 48 Nevada
> 43 82 41 17 Nevada
> Total 75 Nevada <<
> Sub-total
> ****************************
>
> This way I can use my data for better manipulation with less manual
> formatting.
>
> PLEASE HELP.
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Table with many Column Names - How to efficiently generate a list ofhyperlinks to each Column Header Mike C Microsoft Excel Discussion 1 29th Aug 2008 10:53 PM
Return column number from column header text Roger Microsoft Excel Misc 4 14th Feb 2008 09:40 PM
Search for a column based on the column header and then past data from it to another column in another workbook minkokiss Microsoft Excel Programming 2 5th Apr 2007 01:12 AM
Creating a Dynamic Named Range Using Sheet Name and Column Header burl_rfc_h Microsoft Excel Programming 8 13th Feb 2006 10:53 PM
Outlook 2000 - drag a column header here to group by that column Jeff Microsoft Outlook 1 16th Oct 2003 05:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:23 AM.