Emoncada
04-20-2007, 06:17 AM
I have this vb code
Sub Description_New()
' New_Description Macro
Dim res As String, lft As Range
res = InputBox("Please Enter Description")
If res = "" Then
Exit Sub
Else:
ActiveSheet.Unprotect
ActiveCell.Value = res
'----------------------------------------------------------------------
Range("B242:B251").Select
Selection.ClearContents
Range("B242").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]<>"""",""EXPENSE"","""")"
Range("B242").Select
Selection.AutoFill Destination:=Range("B242:B251"), Type:=xlFillDefault
Range("B242:B251").Select
Range("B242").Select
'----------------------------------------------------------------------
With Range("C242:C251").Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
'----------------------------------------------------------------------
'---------------------------------------------------------------------- End If
End Sub
What I need is possible simplify this while adding another inputbox.
Basically I need to add another inputbox, but don't know how to tell it to go the the left of the cell that "res" is entered.
So if res is activecell in C242 then the other inputbox would go into B242.
Hope that explains what i am trying to go for.
Sub Description_New()
' New_Description Macro
Dim res As String, lft As Range
res = InputBox("Please Enter Description")
If res = "" Then
Exit Sub
Else:
ActiveSheet.Unprotect
ActiveCell.Value = res
'----------------------------------------------------------------------
Range("B242:B251").Select
Selection.ClearContents
Range("B242").Select
ActiveCell.FormulaR1C1 = "=IF(RC[1]<>"""",""EXPENSE"","""")"
Range("B242").Select
Selection.AutoFill Destination:=Range("B242:B251"), Type:=xlFillDefault
Range("B242:B251").Select
Range("B242").Select
'----------------------------------------------------------------------
With Range("C242:C251").Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
'----------------------------------------------------------------------
'---------------------------------------------------------------------- End If
End Sub
What I need is possible simplify this while adding another inputbox.
Basically I need to add another inputbox, but don't know how to tell it to go the the left of the cell that "res" is entered.
So if res is activecell in C242 then the other inputbox would go into B242.
Hope that explains what i am trying to go for.