excelliot
04-23-2007, 11:48 PM
I dont understand why dototal is working but dototal2 is not??:banghead:
Option Explicit
Sub dototal()
Dim r1 As Range
Dim r2 As Range
Dim cell As Range
Set r1 = Application.InputBox("Select, with the mouse, the range to be re-assigned", Type:=8)
Set r2 = Application.InputBox("Select, with the mouse, the range to be re-assigned", Type:=8)
Range(r1, r2).Select
For Each cell In Selection
If ActiveCell.Value = "" Then
ActiveCell.Value = ActiveCell.Value
Else
ActiveCell.Value = "=" & ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Next
End Sub
Sub dototal2()
Dim r1 As Range
Dim cell As Range
Set r1 = Application.InputBox("Select, with the mouse, the first range to assign", Type:=8)
For Each cell In r1
If ActiveCell.Value = "" Then
ActiveCell.Value = ActiveCell.Value
Else
ActiveCell.Value = "=" & ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Next
End Sub
Option Explicit
Sub dototal()
Dim r1 As Range
Dim r2 As Range
Dim cell As Range
Set r1 = Application.InputBox("Select, with the mouse, the range to be re-assigned", Type:=8)
Set r2 = Application.InputBox("Select, with the mouse, the range to be re-assigned", Type:=8)
Range(r1, r2).Select
For Each cell In Selection
If ActiveCell.Value = "" Then
ActiveCell.Value = ActiveCell.Value
Else
ActiveCell.Value = "=" & ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Next
End Sub
Sub dototal2()
Dim r1 As Range
Dim cell As Range
Set r1 = Application.InputBox("Select, with the mouse, the first range to assign", Type:=8)
For Each cell In r1
If ActiveCell.Value = "" Then
ActiveCell.Value = ActiveCell.Value
Else
ActiveCell.Value = "=" & ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Next
End Sub