LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default Clearing Comments?

I'm in MS Access VBA, constructing Excel spreadsheets.

During the process, I need to squirrel away a couple of numbers that are
associated with each sheet - to be used later on.

My preference is for the users never to see those numbers and I'm inserting them
as comments rather than cell contents. Now that I think of it, just putting
them into a cell somewhere and then deleting them would be more logical... but
the current approach has raised an issue that I'd like to get to the bottom of.

Namely: When I go to clear the comments, a chart that happens to be positioned
over the range containing the comments seems to get deleted.

Can anybody find anything wrong with the code below? It seems to work without
deleting the chart if I do the .Select... but my understanding is that .Select
in VBA code is bad practice unless it's absolutely needed.

To create the comments:
---------------------------------------------------
3030 With .Range(.Cells(mRowNum_Comment_DealID, mColNum_Comment_DealID),
.Cells(mRowNum_Comment_DealID, mColNum_Comment_DealID))
3031 .AddComment
3032 With .Comment
3033 .Text Text:=Format$(theDealID, "0000000")
3034 .Visible = False
3035 End With
3039 End With

3040 With .Range(.Cells(mRowNum_Comment_TrancheID, mColNum_Comment_TrancheID),
.Cells(mRowNum_Comment_TrancheID, mColNum_Comment_TrancheID))
3041 .AddComment
3042 With .Comment
3043 .Text Text:=Format$(theTrancheID, "0000000")
3044 .Visible = False
3045 End With
3949 End With
---------------------------------------------------

To retrieve, then delete the comments:
---------------------------------------------------
1860 With myWS
1870 With .Range(.Cells(mRowNum_Comment_DealID, mColNum_Comment_DealID),
.Cells(mRowNum_Comment_DealID, mColNum_Comment_DealID))
1871 curDealID = Val(.Comment.Text & "")
'1872 .Select
1873 .ClearComments
1874 End With

1875 With .Range(.Cells(mRowNum_Comment_TrancheID,
mColNum_Comment_TrancheID), .Cells(mRowNum_Comment_TrancheID,
mColNum_Comment_TrancheID))
1876 curTrancheID = Val(.Comment.Text & "")
'1877 .Select
1878 .ClearComments
1879 End With
1899 end with
---------------------------------------------------
--
PeteCresswell
 
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
excel 2000 how to format the comments font all comments Delquestion Excel Discussion (Misc queries) 1 October 8th 09 02:19 PM
Excel 2007 - Clearing All Comments Jeff Lowenstein Excel Discussion (Misc queries) 0 April 10th 09 11:22 PM
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
Code seems to crash after clearing comments L. Howard Kittle Excel Programming 2 February 20th 06 06:43 PM
Code crashes after clearing comments L. Howard Kittle Excel Worksheet Functions 2 February 20th 06 04:54 AM


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

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"