Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Valerie
 
Posts: n/a
Default Macro to find, copy, and paste until value change

On an imported worksheet I have a column that is mostly blanks with a company
number when the report changes. I would like a macro to go to the first
filled in cell, copy it and paste it into every subsequent blank cell until
the next company then copy and paste, etc to the bottom row. Ex:

Row-Value
1
2
3 - A
4
5
6 - B

Copy "A", paste to rows 4 and 5, copy "B", paste to following blank cells,
etc.

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Macro to find, copy, and paste until value change

Valerie -
Instead of a macro you could use a formula in a helper column. For
instance, if your value is in column A, then in cell B3 put the formula

= if (isblank(A3), B2, A3)

then copy this down. Once copied, perform a Copy - Paste Special
Values to remove the formulas.

- John Michl

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
L. A. McClelland
 
Posts: n/a
Default Macro to find, copy, and paste until value change

Valerie:

You can do this easily from the GUI without a macro.

1. Place your cursor in Row 3-A.
2. Hold the Shift key down and then use PageDown and/or the Arrow keys,
etc., to highlight the complete data range.
3. From the menu, select Edit, Go To, Special, Blanks.
4. With the "funny" range selected, build a formula:
a. Press "=" and then the UP arrow.
b. Hold the CTRL key down and then press ENTER.

Voila! All of the blank cells now have a formula that evaluate to the
Company number above.

5. Copy the range and use Paste Special, Values to convert the formulas to
values.

Now you can produce pivot tables or pivot charts to your heart's content.

HTH,

=Mac=

L. A. McClelland



"Valerie" wrote in message
...
On an imported worksheet I have a column that is mostly blanks with a
company
number when the report changes. I would like a macro to go to the first
filled in cell, copy it and paste it into every subsequent blank cell
until
the next company then copy and paste, etc to the bottom row. Ex:

Row-Value
1
2
3 - A
4
5
6 - B

Copy "A", paste to rows 4 and 5, copy "B", paste to following blank cells,
etc.

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
John Michl
 
Posts: n/a
Default Macro to find, copy, and paste until value change

Mac -
That is very slick. I learn something new everyday. Thanks for
sharing. I've never used the Edit - Go To - Special functionality.

- John

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
L. A. McClelland
 
Posts: n/a
Default Macro to find, copy, and paste until value change

John:

You are very welcome. I, too, learn something every time I visit this
group.

=Mac=

"John Michl" wrote in message
oups.com...
Mac -
That is very slick. I learn something new everyday. Thanks for
sharing. I've never used the Edit - Go To - Special functionality.

- John



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
change from copy & paste task pane (yuk) to c&p little box Christie Excel Discussion (Misc queries) 0 October 27th 05 01:39 PM
Copy & Paste macro sparx Excel Worksheet Functions 3 September 13th 05 05:08 AM
Copy Paste Special Macro Bud Hughes Excel Discussion (Misc queries) 2 August 31st 05 02:00 AM


All times are GMT +1. The time now is 12:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"