简体   繁体   中英

How to create a stars review system in Excel for a table?

I am new in VBA, and I got a task to find a way to implement the 5 stars review like in Amazon/Ebay with graphical stars itself for an excel table. Is it possible that? or even to combine with other technologies.

All I need are some hits, how to do that, and where to start.

Based on your last comment I would like to merely sketch the basic concept of doing such rating manually. Since I couldn't fit it in a comment box I'll put it here as a conceptual draft of what it might look like (this is not an attempt to be a solution):

(1) Getting a star on a sheet is as simple as that

Sheet1.Shapes.AddShape Type:=msoShape5pointStar, _
    Left:=100, Top:=100, Width:=7.2, Height:=7.2

(2) Getting four more stars next to it should be simple enough by adding the width of prior star(s) and some extra space to the Left .

(3) Color your star(s) yellow or white with presets (Office 2010+)

.ShapeStyle = msoShapeStylePreset12

(4) In order to locate the stars on the sheet next to the cell containing the value which should be rated you can use the following methods assuming that the value is in cell A1:

.Left = Sheets(1).Range("A1").Left + Sheets(1).Range("A1").Width

Of course, there is a bit more to it than the above. You will have to determine the range of cells for which you want to create stars. Also, if someone adds a column or changes the width of a column then all stars might get changed and will have to be drawn again. Also, you'll have to make sure that the column B is wide enough to hold all the stars. But that's the basic concept (as I would attempt to do it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM