ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value not shown on selected ActiveCell (https://www.excelbanter.com/excel-programming/405196-value-not-shown-selected-activecell.html)

Wellie

Value not shown on selected ActiveCell
 
I have the following code attached to a macro. The macro is associated to a
command button. When the command button is clicked, this macro will ve
invoked and the display/place the result into ActiveCell.

Problem I have is that the macro knows which is the active cell but unable
to place the value in there. Can someone please help to let me know where is
my problem ?
----------- Code Start ---------------
... Other codes ....
If ActiveCell.Column < 4 Then
MsgBox "Sorry! Invalud column selected. It must be on column D",
vbExclamation, "Column Error"
Exit Sub
End If
Select Case Cells(28, 3)
Case 0
ActiveCell.Value = ""
Range(Results_Cell) = ""
Case 1
ActiveCell.Value = ""
Range(Results_Cell) = ""
Case Else
ActiveCell.Value = "Hello" ' Test to see Hello will be place
in active cell.
'ActiveCell.Value = Item(Cells(28, 3) - 1
Debug.Print "Cell(" & ActiveCell.Row & "," & ActiveCell.Column &
")=" _
& Cells(28, 3) & " " & Item(Cells(28, 3) - 1)
End Select
----------- Code End ----------------


Wellie

Value not shown on selected ActiveCell - Fixed
 
Well. I just fixed my own problem which was caused by a clear active cell
line on certain codndition in the wrong place in codes below this segment of
code.

"Wellie" wrote:

I have the following code attached to a macro. The macro is associated to a
command button. When the command button is clicked, this macro will ve
invoked and the display/place the result into ActiveCell.

Problem I have is that the macro knows which is the active cell but unable
to place the value in there. Can someone please help to let me know where is
my problem ?
----------- Code Start ---------------
... Other codes ....
If ActiveCell.Column < 4 Then
MsgBox "Sorry! Invalud column selected. It must be on column D",
vbExclamation, "Column Error"
Exit Sub
End If
Select Case Cells(28, 3)
Case 0
ActiveCell.Value = ""
Range(Results_Cell) = ""
Case 1
ActiveCell.Value = ""
Range(Results_Cell) = ""
Case Else
ActiveCell.Value = "Hello" ' Test to see Hello will be place
in active cell.
'ActiveCell.Value = Item(Cells(28, 3) - 1
Debug.Print "Cell(" & ActiveCell.Row & "," & ActiveCell.Column &
")=" _
& Cells(28, 3) & " " & Item(Cells(28, 3) - 1)
End Select
----------- Code End ----------------



All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com