Can somebody explain Sheets.Activate and Sheets.Select to me? WHen to use, what they do, etc?
And when can I use Cells(1,1) and when do I have to use Sheets(1).Cells(1,1)? This is confusing me.
I wrote this code, and it worked...
Sub doit()
Sheets(1).Activate
If Cells(1, 1) = 1 Then
Sheets(2).Cells(12, 12) = Sheets(1).Cells(9, 9)
End If
End Sub
The I added another if and it didn't work...
Sub doit()
Sheets(1).Activate
If Cells(1, 1) = 1 Then
If Cells(3, 3) = 2 Then
Sheets(2).Cells(12, 12) = Sheets(1).Cells(9, 9)
End If
End If
End Sub
But then I added a Sheets(1). to ONE of the if statements and it worked (it doesn't seem to matter which IF I add it to)
Sub doit()
Sheets(1).Activate
If Sheets(1).Cells(1, 1) = 1 Then
If Cells(3, 3) = 2 Then
Sheets(2).Cells(12, 12) = Sheets(1).Cells(9, 9)
End If
End If
End Sub
Thanks!
And when can I use Cells(1,1) and when do I have to use Sheets(1).Cells(1,1)? This is confusing me.
I wrote this code, and it worked...
Sub doit()
Sheets(1).Activate
If Cells(1, 1) = 1 Then
Sheets(2).Cells(12, 12) = Sheets(1).Cells(9, 9)
End If
End Sub
The I added another if and it didn't work...
Sub doit()
Sheets(1).Activate
If Cells(1, 1) = 1 Then
If Cells(3, 3) = 2 Then
Sheets(2).Cells(12, 12) = Sheets(1).Cells(9, 9)
End If
End If
End Sub
But then I added a Sheets(1). to ONE of the if statements and it worked (it doesn't seem to matter which IF I add it to)
Sub doit()
Sheets(1).Activate
If Sheets(1).Cells(1, 1) = 1 Then
If Cells(3, 3) = 2 Then
Sheets(2).Cells(12, 12) = Sheets(1).Cells(9, 9)
End If
End If
End Sub
Thanks!