Hi Gord,
apparently I need to do my transformation manually or by recording a
macro
because otherwise, my cells options (borders, alignments, colors, etc) get
mist up when actualizing the data/ query. Using the below test micro, only
the data is updated leaving the cells format intact. My problems is that
I've
over 100 cells (a + b = 200) to manually transform. So, perhaps, I need to
think of a loop.
------------------------------------------------------
Sub Macro2()
Sheets("TEST").Select
Range("B16").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=DB!R[-14]C[-1]"
Range("C16").Select
ActiveCell.FormulaR1C1 = "=DB!R[-13]C[-2]"
Range("D16").Select
ActiveCell.FormulaR1C1 = "=DB!R[-12]C[-3]"
Range("E16").Select
ActiveCell.FormulaR1C1 = "=DB!R[-11]C[-4]"
Range("B17").Select
ActiveCell.FormulaR1C1 = "=DB!R[-15]C"
Range("C17").Select
ActiveCell.FormulaR1C1 = "=DB!R[-14]C[-1]"
Range("D17").Select
ActiveCell.FormulaR1C1 = "=DB!R[-13]C[-2]"
Range("E17").Select
ActiveCell.FormulaR1C1 = "=DB!R[-12]C[-3]"
Range("E18").Select
End Sub
--------------------------------------------------------------
Gord Dibben said:
If once a month, automation should not really be required.
But, this macro can be run to copy the sheet1 data to a new sheet.
Sub select_transpose()
Range(Range("A1:B1"), Cells(Rows.Count,
Selection.Column).End(xlUp)).Copy
Sheets.Add
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=True
Application.CutCopyMode = False
Range("A1").Select
End Sub
Gord
The original sourse range is composed of two columns containing
labels(A1)
and numbers (euros B1).
It's variable, every month a new row is added by the query.
"Gord Dibben" <gorddibbATshawDOTca> escribió en el mensaje de noticias
Sheet2 will not update itself using the manual transpose method we
just
did.
We will have to link the cells to the source range then tranpose those
links.
Or write a macro to do the job after each query.
What is your original source range that will be transposed?
Is it consistent or variable range?
Gord
Thank you very much, it worked. But how would sheet 2 update itself
when
sheet 1 is updated refreshing the db connection?
"Gord Dibben" <gorddibbATshawDOTca> escribió en el mensaje de noticias
"Surley I'm doing some wrong"
Yes, you are<g>
Re-read the instructions................I did not say to copy A1
from
sheet1
Select the data range on sheet1 and copy.
Select A1 on sheet2 and Edit>Paste Special>Transpose>OK>Esc
No dragging needed. You are paste/transposing the copied range, not
just
one
cell.
Gord
Thank you Gord,
The data is coming from a SQL query and it is text and money values.
If
I
copy A1 from sheet 1 and paste it as transpose on sheet2 works
however,
if
I
drag A1 horizontally to fulfill the rest of the cells then, the
information
is not coherent. Surly I'm doing some wrong.
"Gord Dibben" <gorddibbATshawDOTca> escribió en el mensaje de
noticias
Copy the data from sheet1
Select A1 of sheet2 and paste special>transpose.
Note: cannot be done if you have more than 16384 rows of data in
column
A
Also, I think you have a typo at A3 to B3.........maybe A3 to C1?
Gord Dibben MS Excel MVP
Hi,
On sheet1 the data is oriented vertically as
A1
A2
A3
I'd like on sheet2 the data be oriented horizontally
A1 to A1
A2 to B1
A3 to B3
Can it be done? if so, how?
TIA
Olga
Excell 07