View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
MSP77079[_13_] MSP77079[_13_] is offline
external usenet poster
 
Posts: 1
Default how to make a chart from formula values? VBA

Turn on the macro recorder (ToolsMacroRecord).

Select one cell in your data table and then press F5 (go to) then clic
on Special, then click on Current Region. This will select your entir
data table without you having to specify exactly how large the tabl
is.

Sort the data table, descending by SUM column.

Now select only the entries with non-zero sums.

Click the chart wizard and set up the chart the way you want it.

Turn off the macro recorder.

Launch Visual Basic Editor (alt-F11).

Change some of the fixed values into variables. For example, you wil
want to vary how many rows of data are non-zero. So you will want
loop that does something like this (assuming the SUM column is colum
"F", and the data start in Row 2):

LastRow = ActiveSheet.cells.specialcells(xlLastCell).Row
For i = 2
If cells(i, "F") = "" or (isNumeric(cells(i, "F")) AND _
cells(i, "F")<=0) then goto LastRowFound
next i

LastRowFound:
If i<LastRow then LastRow = i-1

Good luck. This is the way that we all started

--
Message posted from http://www.ExcelForum.com