Pasting into a row specified by a value in a cell

T

The Grinch

Hello All,

I have the following macro that copies & pastes some data from E93 to
C24...

Range("E93").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Range("C24").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=True

There is a cell B13 that contains a number (positive integer <200). Is
there any way I can amend the macro such that instead of pasting the
data into cell C24 (as above) it pastes into row C and column number
specified by the value in B13.

For example, if B13=68 then the macro pastes the data into C68.

Any suggestions/comments appreciated.

CHEERS
 
R

Rob van Gelder

Sub test()
Dim i As Long, rngSource As Range, rngDest As Range

Set rngSource = Range("E93")
Set rngSource = Range(rngSource, rngSource.End(xlDown))
i = Range("B13").Value
Set rngDest = Range("C" & i)

rngSource.Copy
rngDest.PasteSpecial Paste:=xlPasteValues, Transpose:=True
' Application.CutCopyMode = False
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top