Macro to Copy into active Cell

ziteac

New Member
Joined
Mar 6, 2018
Messages
3
I am new to VBA and I am trying to copy Cells B5-E5 and pasting the values into the active cell I have selected. My issue is that sometimes the column will change I will be pasting in column B-E or F-I and J-M. I was hoping someone can point me in the right direction on how to figure this out.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Welcome to the Board!

If you want to copy paste the from B5:E5 to whatever the ActiveCell is, you only need this one line code.
Code:
Sub MyCopy()
    Range("B5:E5").Copy ActiveCell
End Sub
 
Upvote 0
That is what I originally started with however it never copies the data from those cells and it changes the cell format.

I am not sure why but it looks as if it is posting cells B8-E8 also if I paste on the following Row it pastes cells B9-E9.

Code:
Sub Bonus_Bonus()
'
' Bonus_Bonus Macro
'
' Keyboard Shortcut: Ctrl+Shift+V
'
       Range("B5:E5").copy ActiveCell
End Sub

This is the code I have
 
Upvote 0
That is what I originally started with however it never copies the data from those cells and it changes the cell format.
If you want to JUST copy the values (I assume then that you have formulas in these cells) and no formatting from the original cells, try this:
Code:
Sub MyCopy()
    Range(ActiveCell, ActiveCell.Offset(0, 3)).Value = Range("B5:E5").Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,269
Members
452,628
Latest member
dd2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top