I have 2 rows of data with Row 1 containing only the word Monday repeatedly in every column (various lengths). Under each of these is a relevant figure for each Monday.Under this, down the sheet is a list of Monday to Sunday, and I need the horizontal figures to be pasted in the Monday's vertically (having 6 gaps between where there is no data i.e. nothing Tuesday to Sunday.)Probably as simple as anything, but it's one of those 'tip of your tongue' thingsThanks
Copy, transpose, and insert blanks
-
-
Re: Copy, transpose, and insert blanks
After banging my haed on the desk I got nowhere. As is often the case, I went for a drink, came back, and got the following to complete what I needed:
Code
Display MoreSub insert_blanks() Dim j As Long, r As Range j = InputBox("type the number of rows to be insered") Set r = Range("A1") Rows("1:1").Select Selection.Copy Range("A2").Select Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=True Rows("1:1").Select Application.CutCopyMode = False Selection.Delete Shift:=xlUp Do Range(r.Offset(1, 0), r.Offset(j, 0)).EntireRow.Insert Set r = Cells(r.row + j + 1, 1) If r.Offset(1, 0) = "" Then Exit Do End If Loop End Sub
Issue solved
-
Re: Copy, transpose, and insert blanks
Glad you were able to workout the solution and thanks for sharing it.
Now . . . please learn to use code tags.
All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.
I've added the tags for you this time only. Be sure to use them in future posts.[COLOR="navy"]How to use code tags[/COLOR]
[noparse]
[/noparse]
I've revisited two of your prior threads and added tags for you.
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!