Posts by Foxxy1

    Re: Delete Worksheet If It Exists

    I can't have it delete the sheet at the end otherwise it defeats the purpose of the code that is running. "Cleaned" are the results that I need to look at.

    Re: Delete Worksheet If It Exists

    Hmmm, I modified it a little bit, but it doesn't want to work.

    Dim Clnd As Worksheet
        For Each Clnd In ThisWorkbook.Worksheets
            If Clnd.Name = "Cleaned" Then
                Application.DisplayAlerts = False
                Application.DisplayAlerts = True
                Exit Sub
            End If
        Next Clnd

    Does anyone have SIMPLE code for this that can be run in a normal Sub. My worksheet will always be named "Cleaned". I have seen some posts regarding Functions and other things that seem more complicated than necessary.

    The code below is an attempt to delete all rows where the cell in column A is not equal to the value of B1. B1 is text if that somehow makes a difference.

    Dim n As Long, lastrow As Long
        lastrow = Range("A65536").End(xlUp).Row
        For n = lastrow To 1 Step -1
            If Cells(n, 1) <> Range("B1") Then Cells(n, 1).EntireRow.Delete
        Next n

    Do I need to specify that B1 will always be the cell to reference (ie $B$1).
    Thanks for the help.

    Edit: Just had an epiphany, I also need it to stop after Row 3. I have some headers and such that I don't want removed. Any help there would be appreciated.

    The following is code that I have to hide all the rows beneath the last row containing data. The only problem is it hides that last row of data also. I don't want it to hide that last row of data, how can I make it not?

    Sub Macro1()
        Dim Blnk As Long
        Blnk = Range("A65536").End(xlUp).Row
        Range("A65536", Cells(Blnk, 1)).EntireRow.Hidden = True
    End Sub

    Re: Run Code On Cell Change On Separate Worksheet

    I ended up deleting it because I found a work around, but I still don't think it had to do with what the code was bacuase it would work if I changed the value manually while on the worksheet, but while changing the value from the other sheet it wouldn't. Sorry that I don't have the code anymore.

    I have two option buttons (Designerbutton1 & Designerbutton2), when I copy them and paste them to a different worksheet their names change to Optionbutton# (# = next available number). Anyone know why & if I can prevent this. I cannot have a code that says Optionbutton16 should be renamed to what I want it to, because right now 16 is the next available # but what if I add an Optionbutton16 later on my own.

    Re: Run Code On Cell Change On Separate Worksheet

    Norie -
    The code does nothing at all, it doesn't run. I assumed it's because the sheet inactive.

    Maybe my code is whack. I do know that I have some issues that I need to ammend - however, since the code is wrong, if it was running then the debugger should pop up, right?

    Re: Dont Find Control On Form

    did you detele some cells when you noticed this? You may have it still there just on top of another control. You should try selecting a control nearest it name but before it not after. ie - say optionbutton20 is what you're looking for, try selecting optionbutton19, 17, 15 somewhere near there, then press tab till you come upon optionbutton20.

    I have several option buttons linked to cells on a separate worksheet. Once one of the option buttons is chosen, the cell value changes. When that cell value changes I want it to run code. However, when using the Worksheet_Change method that becomes an issue due to the fact that the worksheet isn't active. Any suggestions?

    Re: Remove .xls From Header

    That does work if I open the attachment, but if I save the file to my drive, it pops back up. What did you mean by xl200? Did you mean the 2000 version? If so, I believe that I have 2000.

    Re: Remove .xls From Header

    Sorry for not being clear enough. If you went to the view menu, you could find Header and Footer...
    In there if you do a custom header as "&[file]", it gives you the workbook name.xls, that's what I don't want shown.
    Thanks again.