Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying values and formatting but not formulae to new worksheet with VBA

I want to select a subset of cells from a complicated worksheet and
copy just the values and formatting from those cells to a new worksheet
programatically. The cells have conditional formatting, which I would
like to have come over as well. I would also like the new worksheet to
be formatted (column width, cell height, etc.) exactly as the source
worksheet.

Is there any way to do this? I know how to create a new empty
worksheet programatically, and I've experimented with various ways of
copying cells, and I can get the values to come over with, e.g.:

Worksheets(5).Range("A" & 1 & ":H" & LastRow - FirstRow).Value =
Worksheets(4).Range("A" & FirstRow & ":H" & LastRow).Value

But I can't figure out how to get the conditional formatting, cell
widths and heights, etc., to come over to the new worksheet.

Any tips would be much appreciated.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Copying values and formatting but not formulae to new worksheet with VBA

Rowan Drummond wrote

For Each cell In Sheets(1).UsedRange
cell.Value = cell.Value
Next cell


FWIW, my experience has been I can write this as:
Sheets(1).UsedRange.Value = Sheets(1).UsedRange.Value

--
David
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copying values and formatting but not formulae to new worksheet with VBA

Thanks, that solves it exactly.

David wrote:
Rowan Drummond wrote

For Each cell In Sheets(1).UsedRange
cell.Value = cell.Value
Next cell


FWIW, my experience has been I can write this as:
Sheets(1).UsedRange.Value = Sheets(1).UsedRange.Value

--
David


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
Copying formulae [email protected] Excel Worksheet Functions 1 October 23rd 08 01:57 PM
Copying Formatting from one Worksheet to another within different Scott Excel Discussion (Misc queries) 4 September 30th 08 01:44 AM
copying an entire worksheet - need absolute values Cowtoon Excel Worksheet Functions 1 December 12th 05 10:08 PM
Hided values appears when I'm copying/pasting it to other worksheet Aivaras_Bakanas Excel Discussion (Misc queries) 2 July 13th 05 02:18 PM
(Newbie) Copying values from an array to the worksheet Srdjan Kovacevic[_5_] Excel Programming 1 July 12th 05 03:47 PM


All times are GMT +1. The time now is 03:36 AM.

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"