Solved

Flagging excel cells in VBA

Posted on 2002-05-10
8
296 Views
Last Modified: 2010-05-02
I am writing an application in VBA to do simple subtotaling, completely independent of the subtotaling functions in excel.
I need a way to mark cells by manipulating a hidden property of some sort, so that the app sees these cells as subtotal cells.  The marking needs to occur through the code, and needs to be invisible to the user.  I can do it by bolding the text for example, but that is not elegant since a user could modify it.  Any ideas?
0
Comment
Question by:lmindlin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 50 total points
ID: 7002293
could you use names?
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7002327
Hi lmindlin,

Going on the way Richie mentioned

-Choose insert | name | define
-then with CTRL+mouseclick select the cells you want to use in teh range
-call it SubTotal

-now in code you can do something like this to loop through the values

Sub t()
Dim c
  For Each c In ActiveWorkbook.Names("SubTotal").RefersToRange.Cells
    MsgBox c.Value
  Next
End Sub

:O)Bruintje
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7002353
<offtopic>
Hi bruintje! where are you when we need you?
could you see this:
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=msoffice&qid=20299301
</offtopic>
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 44

Expert Comment

by:bruintje
ID: 7002368
<OT>i tried something and bk has repeated that in his recap :) i'm EE tired, programming tired and maybe i need a few days off on the beach whenever summer in the Netherlands is kind enough to make that happen<OT>
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7002440
Rest, rest... who needs a keyboard to live anyway?
:)
0
 
LVL 12

Expert Comment

by:roverm
ID: 7002452
<continue offtopic>
Brian:
Well, we should get nice weather Saturday and Sunday so...enjoy life! Then we can get some points as well ;-)
</continue offtopic>

lmindlin:

Yes, I would use the named ranges as well.
However, if you don't like using that, how about creating a "shadow" sheet, hidden for the user (Sheet.Visible = xlVeryHidden) ?
Then use the SelectionChange event to capture the contents of a cell and copy it, along with your properties to the hidden sheet:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Debug.Print Target.Address(, , xlR1C1)
    'build copy code here
End Sub

D'Mzzl!
RoverM
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7002479
<My last OT response here> Mark > weather better be nice since i got to do some work on my new bicycle away from a keyboard.....points enough for everyone these days ;) more then 80000 on Open Q's in Office alone</OT>
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7002748
Thanks for "A" grade but i think bruintje has explained the point better than me.
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question