Posts by Obelix

    Re: Using the .Replace funktion on hidden cells.


    I have also tried this code

    Code
    Sub Makro_Replace()
        Columns("K:K").Replace What:=");;", Replacement:="="""");;", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    End Sub


    It did not work.
    I have tried on a sheet with no rows or columns hidden and it still do not work.

    It does work when I do it manual.
    I am trying to change this formula
    =OM(ELLER(Försäljning!$C$7="";$C$7);;C28*$C$7/Försäljning!$C$7)
    to this
    =OM(ELLER(Försäljning!$C$7="";$C$7="");;C28*$C$7/Försäljning!$C$7).
    There are approximately 58 formulas and each differense a little (the row no after C).

    Hello,


    I want to replace a part of a formula in hidden columns and cells but I don't know which rows are hidden and they have to be remained hidden after the replacement and those rows that aren't hidden must remain unhidden after the replacement.


    I tried this code but it dosen't work on hidden cells:

    Code
    Sub Makro_Replace()
        Columns("K:K").SpecialCells(xlCellTypeFormulas, 23).Replace What:=");;", Replacement:="="""");;", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
    End Sub


    Best regards. Obelix

    Setting the Public Statement does not work.
    These are my codes:

    What ever I do I can't get the Ankis_makro set to True.
    Anyone got an solution for me?


    /Obelix

    Hello
    I'm amtepting to populate some labels from some predefined strings based on the scrollbar value.


    I have these codes:

    Code
    Option Explicit
    Public Meddelande1 As String, Meddelande2 As String, Meddelande3 As String, Meddelande4 As String, Meddelande5 As String, Meddelande6 As String, Meddelande7 As String, Meddelande8 As String, Meddelande9 As String




    I'm trying to make 3 labels content scrollable.



    Thanx
    /Obelix

    Re: Force Focus On Textbox


    Changing tab order didn't do anything.


    However having TextBox1.SetFocus only in UserForm_Initialize didn't work,
    having TextBox1.SetFocus in UserForm_Initialize AND in UserForm_Activate didn't work,
    but having TextBox1.SetFocus only in UserForm_Activate did work.


    Thanx!


    /Obelix

    Re: Force Focus On Textbox


    I have 1 textbox and a few labels and 3 commandbuttons.
    Noone is locked.
    When I tab the first commandbutton gets the focus and if I instead do a shift tab the textbox gets the focus.
    Only the textbox and all the commandbuttons have tabstop enabled.
    None have autotab on.
    I don't have the SetFocus on anything else and I can't see anything else that might function as a setfocus.

    Hello all


    I have tried many variations with the SetFocus but I still can not get it to work?


    I have tried these three variations:

    Code
    [I]UserForm1.TextBox1.SetFocus
    Me.TextBox1.SetFocus
    TextBox1.SetFocus[/I]


    I have tried those in various places like:

    Code
    [I]UserForm_Initialize
    UserForm_Activate[/I]


    I have also tried changing the tab order:
    0
    1


    "Inside" and "outside" of:

    Code
    [I]Application.ScreenUpdating = False
    Application.ScreenUpdating = True[/I]


    I don't know what more to try to get TextBox1 focus on start of the userform.



    Kindest Regards
    /Obelix

    Hello all


    I have a userform that opens a woorkbook and fills some textbox from that woorkbook.
    Although that it goes very fast it is still visible (sometime just in the toolbar) and flickers the screen. Is it possible to open it "hidden"?


    This is how my code looks like:



    Regards
    /Obelix

    Hello all!


    I'm not good at all with IF codes (also not my english isn't good).
    I want help with "cleaning" my current IF code (if possible).
    I tried to se if I could use/learn the examples here http://www.ozgrid.com/VBA/SpeedingUpVBACode.htm but it was to hard for me.
    This is my code (it's a part of a larger code):


    Thanx!
    /Obelix

    Re: Adding New Cells Without Affecting Formulas In Nearby Kolumns And Copy The Contents


    Quote from thomach

    P.S. If you want to add data to only the cell in columns A:D and want the added cells to have the VALUE of the cell above it, rather than a formula refering the cell above it, then here is an alternative.


    It somewhat worked. First problem is that it inserted rows, which made gaps in my formulas that I have in the other columns. Can it use insert cells instead of insert rows? Not sure thout that "insert" won't screw with my ormulas, but it's worth a try first.
    Second is the the range A1:D100 I used in my questions was just an exampel. I don't have my file here at the moment så I can't look up what the real range is, but can't it be made using a selection instead?


    Thanx!
    /Obelix

    Re: Adding New Cells Without Affecting Formulas In Nearby Kolumns And Copy The Contents



    Doing it this way didn't add any new cells for me?

    Hello!


    I have a list that I want every second row to be "moved" and then in the empty ones copied from the above ones.
    exampel: the current list is in A1:D100.
    I want it to be A1:D200 and A2:D2 is a copy of A1:D1; A4:D4 is a copy of A3:D3 etc etc
    I also have a list in E1:H500 that all have formulas that calculates with the values in A:D
    The new rows in A:D may not affect the formulas.
    if a formula in E2 calculates the value in A2, the new cells may not affect the formula so it instead calculates A3!
    I can not change the formulas.


    Sorry for my english, I'm a swede...
    and sorry if this questions was already asked. I tried searching and didn't find anythnig. My searching skill is realy bad.



    Thanx
    /Obelix

    Hello,


    I'm trying to figure out how to write a formula that gets the value in a cell that is in another sheet and part of the sheets name is in another cell in another sheet.


    This exampel gets the contents of cell Q1 in the sheet named "W23 2006" ='W23 2006'!Q1
    What I am looking for is that the formula gets the week number (in the exampel "23") from another cell in sheet "W24 2006".
    An exampel of what I was trying to do: ='W&R1& 2006'!Q1 (but it dosen't work)


    What is an solution?



    Thanx!
    /Obelix

    Re: Userform, labels equals range in workbok, easier code



    Thanx!
    I haven't testet it yet, due to that I haven't created the labels yet.
    I thought I would rename each label to a "smart" name, but renaming 600 labels isn't fun.
    So instead of renaming a label from Label1 to LabelA1 I'm keeping the original name, Label1.
    So how would the code look like for this purpose?
    The labes 1 to 60 is cells A1 to A60 and labels 61 to 120 is cells B1 to B60, etc.



    /Obelix

    Re: Userform, labels equals range in workbok, easier code


    Quote from Badger101

    My solution would to be to rethink what you are doing. I'm just not convinced that you would ever want 500 labels on a userform. Have you actually created all these or are you doing it on the fly?


    I have 60 rows and 10 columns that I want to display somehow and a userform is the most convenient for the users.
    You mean that is simply to many labels?



    /Obelix

    Hello!


    I have over 500 labels in a userform and each labels content is gathered from an workbok like this:

    I have shortened the code and I haven't yet written all labes.
    The ... is supposed to mean "from" and "to".
    I don't want to write over 500 lines of the label codes.
    So what is an easier way to write it?



    Thanx!
    /Obelix