Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Restore all formatting in one step back to a cell?

For a special project I need to be able to copy the contents of one cell to
another *including* all formatting. Sometimes I cannot help but to overwrite
a cell I need later on. The tricky part comes when I have to recall the lost
formatting of that overwritten cell. I basically don't have, or want,
permission to rework any sheets that this little 'machine' is going to be
attached to, nor do I want to put such a burden on its users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed out
to me these objects are read-only. I find that unbelievable, but fact is, I
cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is it
possible?

Ava.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Restore all formatting in one step back to a cell?

I believe that you would have to restore each property (Color/ColorIndex,
Pattern, PatternColor/PatternColorIndex) of the Interior object
individually; e.g.:

rngTest(x, y).Interior.Color = interiorTemp.Color

etc.

Note that this will not help with the formatting of the cell contents (Bold,
Font, Color/ColorIndex, etc.).

--

Vasant


"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one cell
to another *including* all formatting. Sometimes I cannot help but to
overwrite a cell I need later on. The tricky part comes when I have to
recall the lost formatting of that overwritten cell. I basically don't
have, or want, permission to rework any sheets that this little 'machine'
is going to be attached to, nor do I want to put such a burden on its
users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed
out to me these objects are read-only. I find that unbelievable, but fact
is, I cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is
it possible?

Ava.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Restore all formatting in one step back to a cell?

Ava,
What about a linked picture ?

NickHK

"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one cell

to
another *including* all formatting. Sometimes I cannot help but to

overwrite
a cell I need later on. The tricky part comes when I have to recall the

lost
formatting of that overwritten cell. I basically don't have, or want,
permission to rework any sheets that this little 'machine' is going to be
attached to, nor do I want to put such a burden on its users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed

out
to me these objects are read-only. I find that unbelievable, but fact is,

I
cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is

it
possible?

Ava.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Restore all formatting in one step back to a cell?

What about a linked picture ?

You mean copying the link? I wasn't thinking in that direction, but that
should be done to I suppose.


NickHK

"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one cell

to
another *including* all formatting. Sometimes I cannot help but to

overwrite
a cell I need later on. The tricky part comes when I have to recall the

lost
formatting of that overwritten cell. I basically don't have, or want,
permission to rework any sheets that this little 'machine' is going to be
attached to, nor do I want to put such a burden on its users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed

out
to me these objects are read-only. I find that unbelievable, but fact is,

I
cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is

it
possible?

Ava.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Restore all formatting in one step back to a cell?

rngTest(x, y).Interior.Color = interiorTemp.Color

etc.


I'm affraid that is the only way, except hacking with CopyMem, I suppose...


Note that this will not help with the formatting of the cell contents
(Bold, Font, Color/ColorIndex, etc.).


Didn''t get that far yet, but I'll keep an eye on it.

Vasant, is there a reason known to mankind that you know of why these things
are not working in both directions?

Ava.


--

Vasant


"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one cell
to another *including* all formatting. Sometimes I cannot help but to
overwrite a cell I need later on. The tricky part comes when I have to
recall the lost formatting of that overwritten cell. I basically don't
have, or want, permission to rework any sheets that this little 'machine'
is going to be attached to, nor do I want to put such a burden on its
users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed
out to me these objects are read-only. I find that unbelievable, but fact
is, I cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is
it possible?

Ava.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Restore all formatting in one step back to a cell?

Ava,
Or copy the cell that you wish to preserve somewhere safe, do your stuff,
then copy the original back.

NickHK

"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one cell

to
another *including* all formatting. Sometimes I cannot help but to

overwrite
a cell I need later on. The tricky part comes when I have to recall the

lost
formatting of that overwritten cell. I basically don't have, or want,
permission to rework any sheets that this little 'machine' is going to be
attached to, nor do I want to put such a burden on its users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed

out
to me these objects are read-only. I find that unbelievable, but fact is,

I
cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is

it
possible?

Ava.




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Restore all formatting in one step back to a cell?

Or copy the cell that you wish to preserve somewhere safe, do your stuff,
then copy the original back.


That's only an option for my own sheets I think. I don't know what would
happen with full sheets or protected sheets/workbooks. Won't be pretty, I
suppose.


NickHK

"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one cell

to
another *including* all formatting. Sometimes I cannot help but to

overwrite
a cell I need later on. The tricky part comes when I have to recall the

lost
formatting of that overwritten cell. I basically don't have, or want,
permission to rework any sheets that this little 'machine' is going to be
attached to, nor do I want to put such a burden on its users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types don't
match)

The help in my version of Excel doesn't specify this but someone pointed

out
to me these objects are read-only. I find that unbelievable, but fact is,

I
cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a Style.

I could write a lot of code and restore the members of the saved objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell? Is

it
possible?

Ava.






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Restore all formatting in one step back to a cell?

Ava,
Well, if it's protected, wll you be able to achieve the initial copy anyway.
What are you trying to achieve ?

NickHK

"Ava" <dontspam@comeon wrote in message
...
Or copy the cell that you wish to preserve somewhere safe, do your

stuff,
then copy the original back.


That's only an option for my own sheets I think. I don't know what would
happen with full sheets or protected sheets/workbooks. Won't be pretty, I
suppose.


NickHK

"Ava" <dontspam@comeon wrote in message
...
For a special project I need to be able to copy the contents of one

cell
to
another *including* all formatting. Sometimes I cannot help but to

overwrite
a cell I need later on. The tricky part comes when I have to recall the

lost
formatting of that overwritten cell. I basically don't have, or want,
permission to rework any sheets that this little 'machine' is going to

be
attached to, nor do I want to put such a burden on its users.

For instance, I can get .Interior and put it in an object variable like
this:

Dim interiorTemp as Interior

Set interiorTemp = rngTest(x, y).Interior

Now interiorTemp has all parameters for font, pattern and their color.
Nifty. But I cannot find *any* simple way to do the reverse:

Set rngTest(x, y).Interior = interiorTemp (Error 13, types

don't
match)

The help in my version of Excel doesn't specify this but someone

pointed
out
to me these objects are read-only. I find that unbelievable, but fact

is,
I
cannot restore.

Some forum members (not this forum) told me to swap the styles. But the
cells could have any additional formatting that is not stored in a

Style.

I could write a lot of code and restore the members of the saved

objects
one-by-one. If I didn't have to swap I could use rngsource.Copy
rngdestination, which seems to do everything I need, until I need to

swap
contents of two cells.

So, the simple question is: How do I put saved formatting into a cell?

Is
it
possible?

Ava.








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
Creating a Drop Down List with Step by Step Instructions for 2007 remarkable Excel Worksheet Functions 2 March 22nd 09 04:36 AM
How do restore the content of a excel spreadsheet back 2 weeks. ILoveWork... Excel Discussion (Misc queries) 2 November 7th 08 07:53 PM
Need step by step to add invoice numbering to excel template rmt New Users to Excel 4 July 6th 08 11:45 PM
I need step by step instructions to create a macro for 10 imbedde. diana Excel Worksheet Functions 3 January 31st 05 01:56 AM
Step back Weng-Kit Tan Excel Programming 1 August 3rd 04 10:57 AM


All times are GMT +1. The time now is 01:04 PM.

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

About Us

"It's about Microsoft Excel"