An implementation of Visual Basic that is built into Microsoft products.
Copy the source range directly to ActiveCell by passing it as the Destination; if the user selects B200, B7:B39 will be copied into B200:B232.
Sub CopyRowText()
Dim ws As Worksheet
Dim target As Range
Set ws = ActiveSheet
Set target = ActiveCell
ws.Range("B7:B39").Copy Destination:=target
End Sub
The Destination only needs to identify the upper-left destination cell; Excel sizes the pasted area to match the source range. This copies values, formulas, and formatting without a separate Paste operation.^1^
Check the row count
B7:B39 contains 33 rows, not 32:
39 - 7 + 1 = 33
Therefore:
- To copy 33 rows, use
B7:B39. - To copy 32 rows, use
B7:B38.
If the macro inserts rows before copying, save the user's selected cell first so later operations do not change which cell is active:
Sub InsertAndCopy()
Dim ws As Worksheet
Dim target As Range
Set ws = ActiveSheet
Set target = ActiveCell
'Your row-insertion code goes here.
ws.Range("B7:B38").Copy Destination:=target
Application.CutCopyMode = False
End Sub
Copy text/values only
If “row text” means only the displayed underlying values—not formulas or formatting—avoid the Clipboard and resize the destination to the same dimensions as the source:
Sub CopyValuesOnly()
Dim source As Range
Dim target As Range
Set source = ActiveSheet.Range("B7:B38")
Set target = ActiveCell
target.Resize(source.Rows.Count, source.Columns.Count).Value = source.Value
End Sub
Resize returns a range with the requested number of rows and columns.^2^
If the source must always come from a specific sheet, replace ActiveSheet with an explicit worksheet reference:
Set ws = ThisWorkbook.Worksheets("Sheet1")
This avoids copying from the wrong sheet if another worksheet becomes active.
References