0
votes

Newbie here so appols if the answer is obvious

My spreadsheet has a list of cells, for arguements sake A1 to A10, that contains both data and formatting in a certain way.

I wish to be able to create 10 macro's - 1 for each cell, that will allow me to paste the data and formatting of this particular cell into whatever the pre selected cell or range is:

For arguements sake : I select cell range b3:b10, i want to be able to run a macro that will cut and paste then contents of cell a1, into this range (b3:b10).

Cheers

Wilmsta

1
Have you tried using the macro recorder ?ApplePie
I have but I'm not sure how to re-select the active cell (or range) once I've copied from the other cell (if that makes sense!)user2241138

1 Answers

0
votes

You only need one macro for this.

An inputbox asks you which cell you want to copy.

The cell will be pasted to whatever range is the current selection.

Sub CopyCellToRange()
Dim clAddress As String
Dim cl As Range
Dim rng As Range

Set rng = Range(Selection.Address)
clAddress = InputBox("Enter the address of the cell you want to copy", "Input Range", "A1")
Set cl = Range(clAddress)
cl.Copy
ActiveSheet.Paste
End Sub