Posts by lenze

    Re: Formula: Input in anyone of three cells solves for other two.


    So, you DON'T really need to place a formula in any of the cells. You just want to calculate and populate the other 2 when 1 of them is changed. Is that correct??. The code above does that, but we can't help you unless we know the formulas.


    lenze

    Re: Formula: Input in anyone of three cells solves for other two.



    lenze

    Re: Auto Sort


    Use a WorkSheet Change Event on H4:H16 and place the sort code in it. You can get the syntax by recording a macro while preforming a Sort
    lenze

    Re: Automatically Add The Username And Date In Cells


    Like this??

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Target.Row <> 3 Then Exit Sub
    If UCase(Target) = "X" Then
    Cells(4, Target.Column) = Date & " " & Time & " by " & Environ("UserName")
    End If
    End Sub


    That said why not use a comment?

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Count > 1 Then Exit Sub
        If Target.Row <> 3 Then Exit Sub
        If UCase(Target) = "X" Then
        Target.ClearComments
        Target.AddComment.Text Text:="Revised " & Format(Date, "mm-dd-yyyy") & " at " & Time & Chr(10) & "By " & Environ("UserName")
        End If
    End Sub


    lenze

    Re: Log Worksheet Changes


    Another approach that I find useful is to use a comment to track changes


    Reference http://vbaexpress.com/kb/getarticle.php?kb_id=909


    lenze

    Re: Selecting Adjacent Cells


    You may need to combine Offset with Resize

    Code
    Range("C10").Offset(-3,0).Resize(7,1).Select


    Are you sure you really need to select? You usually can work with ranges without selecting them.

    Code
    Range("C10").Offset(-3,0).Resize(7,1).Copy Sheet2.Range("$A$1")


    This will copy C7:C13 To Sheet2 A1.
    Edit: Yu can use ActiveCell instead of a range such as C10

    Code
    ActiveCell.Offset(-3,0).Resize(7,1).Copy Sheet2.Range("$A$1")


    lenze

    Re: Lock Cells Passed Current Date


    Where did you place the code/ it should be in the ThisWorkBook module. Right click the Excel icon left of "File" on the menu bar and choose "View Code"


    Also, if row 1 is a header row, change the line

    Code
    For Each cl In Sheet1.Range("$A$1:$A" & Range("$A$65536").End(xlUp).Row)

    to

    Code
    For Each cl In Sheet1.Range("$A$[b]2[/b]:$A" & Range("$A$65536").End(xlUp).Row)


    lenze

    Re: Lock Cells By Current Date


    Assuming Date in Column A

    Code
    Private Sub Workbook_Open()
    Dim cl As Range
    For Each cl In Sheet1.Range("$A$1:$A" & Range("$A$65536").End(xlUp).Row)
    If cl < Date - 1 Then Range(Cells(cl.Row, 1), Cells(cl.Row, 21)).Locked = True
    Next cl
    End Sub


    lenze

    Re: Popup Message Before Saving With Conditions


    Since your sample does not contain code, I'm guessing Dave used a BeforeSave Event.

    Code
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If Sheet1.Range("D7") = "RET" And Sheet1.Range("D15") = 0 Then
        MsgBox "Whatever"
        Cancel = True
    End If
    End Sub


    lenze

    Re: Adding A Value To A Value


    Something like this?

    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address <> "$C$1" Then Exit Sub
    Range("$E$1") = Range("$E$1") & " " & Target.Text
    End Sub


    Assumming your dropdown is in $C$1 and your cell to append is in $E$1


    lenze