PDA

View Full Version : [SOLVED] Spreadsheet inside a Userform



makako
04-28-2008, 03:30 PM
Im using an inserted sheet in my userform to connect data into a chart. I wasnt able to set any Range variables into the userform spreadsheet but managed my way through some issues until a worksheet function

The code below works for most pusposes in the spreadsheet



lvRange as variant
Set lvRange = .spshData.Range("A1:A" & .spshData.Range("A1").End(xlDown).Row)


instead of



lvRange as Range
Set lvRange = .spshData.Range(Range("A1"):Range("A1").End(xlDown))


I can also use worksheetfunctions such as "SUM(lvrange)", etc. but when the function specifically need "Range" as an argument ( as Subtotal does ) it shows an error. Is there a way to set a range to the spreadsheet? or to fool the subtotal function? Currently I have to copy the data to the workbook, excecute the ops and return the subtotals. Thanks

rory
04-29-2008, 05:55 AM
You need to specify that it's an OWC range, not an Excel Range:


Dim lvRange as OWC10.Range

if you're using OWC10 for example.

mikerickson
04-29-2008, 06:04 AM
The two argument form of Range is not a property

lvRange As Range
Set lvRange = Range(spshDate.Range("A1"), spshDate.Range("A1").End(xlDown))

makako
04-29-2008, 02:56 PM
Thanks Rory, really helpful specially when managing charts in the uform but Im still having problems with the functions requiring RANGES. For Excel a Range and a OWC11.Range is different when worksheetfunctions?

rory
04-29-2008, 03:23 PM
Which functions are you using as a matter of interest, and can you not put them into the spreadsheet itself?

makako
04-29-2008, 04:44 PM
I tried but the subtotal function doesnt work for me

rory
04-30-2008, 01:56 AM
That should just be a question of something like this:

Spreadsheet1.Range("A6").Formula = "=SUBTOTAL(9,A1:A5)"
End Sub