Consulting

Results 1 to 7 of 7

Thread: Spreadsheet inside a Userform

  1. #1
    VBAX Contributor
    Joined
    Aug 2006
    Posts
    120
    Location

    Spreadsheet inside a Userform

    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

  2. #2
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    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.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Mac Moderator VBAX Guru mikerickson's Avatar
    Joined
    May 2007
    Location
    Davis CA
    Posts
    2,778
    The two argument form of Range is not a property
    lvRange As Range 
    Set lvRange = Range(spshDate.Range("A1"), spshDate.Range("A1").End(xlDown))

  4. #4
    VBAX Contributor
    Joined
    Aug 2006
    Posts
    120
    Location
    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?

  5. #5
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    Which functions are you using as a matter of interest, and can you not put them into the spreadsheet itself?
    Regards,
    Rory

    Microsoft MVP - Excel

  6. #6
    VBAX Contributor
    Joined
    Aug 2006
    Posts
    120
    Location
    I tried but the subtotal function doesnt work for me

  7. #7
    VBAX Master
    Joined
    Jun 2007
    Location
    East Sussex
    Posts
    1,110
    Location
    That should just be a question of something like this:
    Spreadsheet1.Range("A6").Formula = "=SUBTOTAL(9,A1:A5)"
    End Sub
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •