Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel 2000 how to format the comments font all comments | Excel Discussion (Misc queries) | |||
Excel 2007 - Clearing All Comments | Excel Discussion (Misc queries) | |||
Clearing cells without clearing formulas | Excel Discussion (Misc queries) | |||
Code seems to crash after clearing comments | Excel Programming | |||
Code crashes after clearing comments | Excel Worksheet Functions |