christianbiker
Active Member
- Joined
- Feb 3, 2006
- Messages
- 379
Greetings all,
I am hoping someone can help me with transposing. I have used the function within Excel but it doesn;t do what I need. It will be a loop for sure. What I need to do is transpose data horizontally in one worksheet to vertically into another worksheet ensuring that certain formatting/spacing is done simulataneously. I have included a before & after example below. Here are the criteria I need to meet:
- The top line is the name...it needs to be bold
- If there are blank cells on a given row I need them ignored with no lines between the data when transposed vertically
- The examples should provide everything else I need by way of visual
Before
Excel 2003
After
Excel 2003
Using the recorder in Excel this is what I came up with, but this would be very time consuming as people are added.
Sub transpose()
'
' transpose Macro
' Macro recorded 15/04/2011 by Chad King
'
'
Range("E3:K3").Select
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("C1").Select
Sheets("DATABASE").Select
Range("E4:K4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("E1").Select
Sheets("DATABASE").Select
Range("E5:K5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("A9").Select
Sheets("DATABASE").Select
Range("E6:K6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("C9").Select
Sheets("DATABASE").Select
Range("E7:K7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("E9").Select
Sheets("DATABASE").Select
Range("E8:K8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Range("E9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("A1,C1,E1,A9,C9,E9").Select
Range("E9").Activate
Selection.Font.Bold = True
Range("A1").Select
End Sub
Thanks,
Chad
I am hoping someone can help me with transposing. I have used the function within Excel but it doesn;t do what I need. It will be a loop for sure. What I need to do is transpose data horizontally in one worksheet to vertically into another worksheet ensuring that certain formatting/spacing is done simulataneously. I have included a before & after example below. Here are the criteria I need to meet:
- The top line is the name...it needs to be bold
- If there are blank cells on a given row I need them ignored with no lines between the data when transposed vertically
- The examples should provide everything else I need by way of visual
Before
Excel Workbook | |||||||||
---|---|---|---|---|---|---|---|---|---|
E | F | G | H | I | J | K | |||
3 | Clark, Jim | 32 Wilson St. | Townsend | LW5 1W6 | |||||
4 | King, Chris & Mary | 15 Prospect St. | Toronto | LW5 1W6 | 555-555-5555 | 555-555-5555 | 555-555-5555 | ||
5 | Knoop, Oliver | ||||||||
6 | Morningstar, Rob & Lisa | 21 King St. | St. Catharines | LW5 1W5 | 555-555-5555 | 555-555-5555 | 555-555-5555 | ||
7 | Snodgrass, Mark & Ruth | 18 Main St. | Mississauga | LW5 1W6 | 555-555-5555 | ||||
8 | Turner, Tim & Lisa | 5 Main St. | Brampton | LW5 1W6 | |||||
DATABASE |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E3 | =IF(M3="YES", B3 & ", " & C3,"") | |
E4 | =IF(M4="YES", B4 & ", " & C4,"") | |
E5 | =IF(M5="YES", B5 & ", " & C5,"") | |
E6 | =IF(M6="YES", B6 & ", " & C6,"") | |
E7 | =IF(M7="YES", B7 & ", " & C7,"") | |
E8 | =IF(M8="YES", B8 & ", " & C8,"") |
After
Excel Workbook | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Clark, Mark | King, Chad & Julie | Knoop, Oliver | ||||
2 | 32 Wilson St. | 15 Prospect St. | |||||
3 | Townsend | Toronto | |||||
4 | LW5 1W6 | LW5 1W6 | |||||
5 | 555-555-5555 | ||||||
6 | |||||||
7 | Morningstar, Rob & Lisa | Snodgrass, Dave & Ruth | Turner, Rick & Mary Ann | ||||
8 | 21 King St. | 18 Main St. | 5 Timberglade Dr. | ||||
9 | St. Catharines | Mississauga | Brampton | ||||
10 | LW5 1W5 | LW5 1W6 | LW5 1W6 | ||||
11 | 555-555-5555 | 555-555-5555 | |||||
DETAILED DIRECTORY |
Using the recorder in Excel this is what I came up with, but this would be very time consuming as people are added.
Sub transpose()
'
' transpose Macro
' Macro recorded 15/04/2011 by Chad King
'
'
Range("E3:K3").Select
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("C1").Select
Sheets("DATABASE").Select
Range("E4:K4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("E1").Select
Sheets("DATABASE").Select
Range("E5:K5").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("A9").Select
Sheets("DATABASE").Select
Range("E6:K6").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("C9").Select
Sheets("DATABASE").Select
Range("E7:K7").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("E9").Select
Sheets("DATABASE").Select
Range("E8:K8").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("DETAILED DIRECTORY").Select
Range("E9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=True, transpose:=True
Range("A1,C1,E1,A9,C9,E9").Select
Range("E9").Activate
Selection.Font.Bold = True
Range("A1").Select
End Sub
Thanks,
Chad
Last edited: