Consulting

Results 1 to 5 of 5

Thread: Solved: Another cross platform problem

  1. #1
    VBAX Regular
    Joined
    Oct 2005
    Posts
    8
    Location

    Solved: Another cross platform problem

    Hi,

    I have another issue with cross platforming from PC to Mac.

    I'm not receiving any errors, but when the form NEXTPRACA1 is loaded it is ignoring the data that should be shown from the sheet "PRACA" in the a3:s3 columns. It just keeps repeating the same data no matter what data is selected. On the PC the range a3:s3 is shown on the form per the data selected. I'm back to the what coding works on PC doesn't necessarily work on a Mac. The form shows perfectly on the Mac but not the data.

    [VBA] Sub TextBox4_Click()
    Range("A1:t99").AdvancedFilter _
    Action:=xlFilterCopy, _
    CriteriaRange:=Range("u1:u2"), _
    CopyToRange:=Range("v1:ao1"), Unique:=False
    Range("w2:ao2").Copy
    Sheets("PRACA").Select
    Range("A3:s3").Select
    Selection.PasteSpecial
    Sheets("Select").Select
    Range("a2:a99").ClearContents
    Range("A2").Select
    Application.ScreenUpdating = True
    NEXTPRACA1.Show
    End Sub
    [/VBA]

    Any suggestions would be appreciated.

    Thank you,
    prm

  2. #2
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    I don't know how you're populating the userform. You should have code explicitly loading data into controls, either before showing it in the calling procedure, or in a UserForm_Activate procedure in the form's code module. (I've found, and others have concurred, that linking userform controls to worksheet ranges is less than ideal.)

    Also note, that if you populate the form when it is first instantiated, then merely hide and reshow the form, it is still populated with the original values, unless you've explicitly reloaded new values.
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  3. #3
    VBAX Regular
    Joined
    Oct 2005
    Posts
    8
    Location
    I am loading the data from the spreadsheet by using =PRACA!E3 (cell location of data) into the form data fields, I guess not the ideal way.
    I will try a UserForm_Activate procedure in the form's code module and see if that helps.

    Thank you for your help.
    prm

  4. #4
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    In the UserForm_Activate event procedure, use code like

    TextBox1.Value = Worksheets("Praca").Range("E3").Value

    Then in CommandButton1_Click (the OK or Apply button), use this to populate the workbook:

    Worksheets("Praca").Range("E3").Value = TextBox1.Value

    to populate the form's controls. This allows you to change values in textboxes, then cancel the form without changing the workbook.

    If all of the data is in a contiguous range in the worksheet, you can load it in one step into a VBA array, and update the sheet in one step, which will speed up the process considerably.
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  5. #5
    VBAX Regular
    Joined
    Oct 2005
    Posts
    8
    Location
    Thanks Jon! That is what I needed to fix it.

    prm

Posting Permissions

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