Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default How to save entire Cell in a variable and put it back later?

Hello -

I wrote a little deleteCell() function that deletes a cell and shifts
the cells below up. I had to do that because most of the sheet is
locked and I don't want the user to fool with it. So I wanted to give
the option of a undelete as well. I store the .Value and
..Interior.ColorIndex in a string and integer respectively.

I was wondering if I could store the entire cell in an object or
something like that? I want to keep all the formatting including
character font etc. ...

I tried ...

' Global
dim gCell as object

Set gCell = lSheet.Cell(1,1)

This works ... just not when I try to assign it back later ...

lSheet.Cell(1,1) = gCell

I cannot just copy it to the clipboard because the user might put other
stuff there in-between the calls.

How can I make this work to easily store and restore the format of the
cell. Would the CellFormat type work instead of the Object type?

Thanks,
Joe

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to save entire Cell in a variable and put it back later?

Joe,

You could hide a column and store a copy of the cell there.

Jim Cone
San Francisco, USA


"Joe HM" wrote in message
ups.com...
Hello -

I wrote a little deleteCell() function that deletes a cell and shifts
the cells below up. I had to do that because most of the sheet is
locked and I don't want the user to fool with it. So I wanted to give
the option of a undelete as well. I store the .Value and
.Interior.ColorIndex in a string and integer respectively.

I was wondering if I could store the entire cell in an object or
something like that? I want to keep all the formatting including
character font etc. ...

I tried ...

' Global
dim gCell as object

Set gCell = lSheet.Cell(1,1)

This works ... just not when I try to assign it back later ...

lSheet.Cell(1,1) = gCell

I cannot just copy it to the clipboard because the user might put other
stuff there in-between the calls.

How can I make this work to easily store and restore the format of the
cell. Would the CellFormat type work instead of the Object type?

Thanks,
Joe

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 83
Default How to save entire Cell in a variable and put it back later?

I would store the cell and format with contents on a hidden worksheet. If
hidden new cell is named from within that sheet then the range is not visable
to the user and hidden columns or rows bug some people.

"Joe HM" wrote:

Hello -

I wrote a little deleteCell() function that deletes a cell and shifts
the cells below up. I had to do that because most of the sheet is
locked and I don't want the user to fool with it. So I wanted to give
the option of a undelete as well. I store the .Value and
..Interior.ColorIndex in a string and integer respectively.

I was wondering if I could store the entire cell in an object or
something like that? I want to keep all the formatting including
character font etc. ...

I tried ...

' Global
dim gCell as object

Set gCell = lSheet.Cell(1,1)

This works ... just not when I try to assign it back later ...

lSheet.Cell(1,1) = gCell

I cannot just copy it to the clipboard because the user might put other
stuff there in-between the calls.

How can I make this work to easily store and restore the format of the
cell. Would the CellFormat type work instead of the Object type?

Thanks,
Joe


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default How to save entire Cell in a variable and put it back later?

"Joe HM" wrote in message
ups.com...
Hello -

I wrote a little deleteCell() function that deletes a cell and shifts
the cells below up. I had to do that because most of the sheet is
locked and I don't want the user to fool with it. So I wanted to give
the option of a undelete as well. I store the .Value and
.Interior.ColorIndex in a string and integer respectively.

I was wondering if I could store the entire cell in an object or
something like that? I want to keep all the formatting including
character font etc. ...

I tried ...

' Global
dim gCell as object

Set gCell = lSheet.Cell(1,1)

This works ... just not when I try to assign it back later ...

lSheet.Cell(1,1) = gCell


maybe you need to copy property_by_property from "memory object" to
another cell [maybe not all of them, but at least interesting ones]?
something like:

sub cell_put(cell as range, gcell as variant)
with cell do
.value=gcell.value
.format=gcell.format
'rest of interesting props here

end with
end sub







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
To give back ground colour for entire row on certain condition pol Excel Discussion (Misc queries) 6 May 22nd 09 11:41 AM
How to save same excel workbook in different folders as a back up GRAPH WITH A MACRO Excel Discussion (Misc queries) 2 October 13th 08 04:35 PM
Issue with save xls file to html and than back to xls Bud Excel Discussion (Misc queries) 1 October 2nd 08 04:21 PM
SAVE is not available in Excel under FILE. How do I get it back? ldk Excel Discussion (Misc queries) 7 July 25th 05 09:59 PM
Sending variable data to a web site to be computed then brought back to Excel David Excel Programming 0 April 27th 04 09:44 AM


All times are GMT +1. The time now is 09:57 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"