chamster
09-04-2007, 12:06 AM
I tried the following code
Union(.Range(.Cells(2, 8), .Cells(periods + 1, 8)), .Range(periods + 3, 8, 2 * periods + 3, 8)).Select
Selection.NumberFormat = "hh:mm,@"
as well as a not so sophisticated version
.Range(.Cells(2, 8).Cells(2 * periods + 3, 8)).Select
Selection.NumberFormat = "hh:mm,@"
and in both cases the area gets selected BUT the format doesn't stay (or isn't changed - i don't know which. Why and how do i kill it?
On a very similar subject - i try to copy a range and paste it in INCLUDING the formatting. What i do is the following.
With ActiveSheet
.Range(.Cells(1, 1), .Cells(periods, 1)).Select
Selection.Copy
.Range(.Cells(2, 8), .Cells(periods + 1, 8)).Select
.Paste
.Range(.Cells(periods + 3, 8), .Cells(2 * periods + 3, 8)).Select
.Paste
.Range(.Cells(2, 8).Cells(2 * periods + 3, 8)).Select
Selection.NumberFormat = "hh:mm,@"
End With
For some reason (which i'm sure i'll be quickly made aware of soon) the formatting dosn't follow the copy process. How do i enforce it?
Union(.Range(.Cells(2, 8), .Cells(periods + 1, 8)), .Range(periods + 3, 8, 2 * periods + 3, 8)).Select
Selection.NumberFormat = "hh:mm,@"
as well as a not so sophisticated version
.Range(.Cells(2, 8).Cells(2 * periods + 3, 8)).Select
Selection.NumberFormat = "hh:mm,@"
and in both cases the area gets selected BUT the format doesn't stay (or isn't changed - i don't know which. Why and how do i kill it?
On a very similar subject - i try to copy a range and paste it in INCLUDING the formatting. What i do is the following.
With ActiveSheet
.Range(.Cells(1, 1), .Cells(periods, 1)).Select
Selection.Copy
.Range(.Cells(2, 8), .Cells(periods + 1, 8)).Select
.Paste
.Range(.Cells(periods + 3, 8), .Cells(2 * periods + 3, 8)).Select
.Paste
.Range(.Cells(2, 8).Cells(2 * periods + 3, 8)).Select
Selection.NumberFormat = "hh:mm,@"
End With
For some reason (which i'm sure i'll be quickly made aware of soon) the formatting dosn't follow the copy process. How do i enforce it?