laxminarayana
Board Regular
- Joined
- Nov 16, 2013
- Messages
- 56
Hi,
I have placed two command buttons in "sheet1" each of which will insert some text into a cell in Sheet2. The problem is that when i click two command buttons one after the other, I don't see two sentences in cell (Sheet2)
Following is the code that i have assigned to "commandbutton1"
Sub autotext()
If Worksheets("Sheet1").Range("B1").Value = Worksheets("Sheet1").Range("B3").Value Then
Worksheets("Sheet2").Activate
Range("D1").Select
Range("D1").Value = "This is sentence one" & vbNewLine & vbNewLine
Else
Worksheets("Sheet2").Activate
Range("D1").Select
Range("D1").Value = "N/A sorry" & vbNewLine & vbNewLine
End If
End Sub
And Following is the code that i have assigned to "commandbutton2"
Sub autotext2()
Worksheets("Sheet2").Activate
Range("D1").Select
Range("D1").Value = "This is second sentence" & vbNewLine & vbNewLine
End Sub
Thanks in Advance.
I have placed two command buttons in "sheet1" each of which will insert some text into a cell in Sheet2. The problem is that when i click two command buttons one after the other, I don't see two sentences in cell (Sheet2)
Following is the code that i have assigned to "commandbutton1"
Sub autotext()
If Worksheets("Sheet1").Range("B1").Value = Worksheets("Sheet1").Range("B3").Value Then
Worksheets("Sheet2").Activate
Range("D1").Select
Range("D1").Value = "This is sentence one" & vbNewLine & vbNewLine
Else
Worksheets("Sheet2").Activate
Range("D1").Select
Range("D1").Value = "N/A sorry" & vbNewLine & vbNewLine
End If
End Sub
And Following is the code that i have assigned to "commandbutton2"
Sub autotext2()
Worksheets("Sheet2").Activate
Range("D1").Select
Range("D1").Value = "This is second sentence" & vbNewLine & vbNewLine
End Sub
Thanks in Advance.