Need Macro help with Copy and paste off of active cells

Zoso4

New Member
Joined
Mar 26, 2013
Messages
12
Hi,

I have a macro in one of my excel files that basically selects a list of cells from another page in the workbook and pastes those into the active cell. (it is a list of locations and nominal values) for example I would run this macro and paste it into say cell H30 tand it would fill in down to H90. then in A30-G30 I add in the date, and other disctribing factors to what is being measured and input and copy and paste that down by hand.

is there anyway to run a macro on the tail end of my current macro to move over 6 cells to the left, highlight the descriptive data, then paste it down with the rest of the nominals?

the descriptive data is different and the locations change as I add data to the spread sheet. I feel like this is possible but I do not have the from scratch macro skills to get it down. Help is greatly appreciated =]
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Put in the date and descriptive data first before you run the macro, then at the beginning of your macro insert the line:

Code:
Dim rDescript As Range, lLastRow As Long
Set rDescript = ActiveCell.Offset(0, -7).Resize(1, 7)

at the end of the macro add:

Code:
lLastRow = Range("H" & Rows.Count).End(xlUp).Row
rDescript.Resize(lLastRow + 1 - rDescript.Row, 7) = rDescript.Value

I've based the code on your request to use the activecell but for your general info it is not great practice to run a macro based on the activecell position. If you start the above with the activecell in other than Column H you'll get either unexpected results, or an application error.

See the second last line of code I put in above as to how you can find the end of a row of data to add to it.
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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