Home |
Search |
Today's Posts |
#1
|
|||
|
|||
ActiveCell giving blank value in vbscript
I am having the following code: oSheet.Cells(2,3).Select msgbox oSheet.Cells(2,3).value Msgbox ActiveCell.Value The cell is having value, but still, its giving the following error: Error Description: Object Required 'ActiveCell' i did the following also: msgbox activecell but its giving me a blank messagebox Please someone help me out in this . Thanks in advance -- itstome ------------------------------------------------------------------------ itstome's Profile: http://www.excelforum.com/member.php...o&userid=26787 View this thread: http://www.excelforum.com/showthread...hreadid=400413 |
#2
|
|||
|
|||
Most likely, the activecell is blank, since you cannot change the selection on an inactive sheet.
Activecell refers to the selection on the activesheet, so you need to activate your sheet prior to selecting: Dim oSheet As Worksheet Set oSheet = Worksheets("Sheet1") oSheet.Activate oSheet.Cells(2, 3).Select MsgBox oSheet.Cells(2, 3).Value MsgBox ActiveCell.Value But your code need not rely on Activecell: Dim oSheet As Worksheet Set oSheet = Worksheets("Sheet1") MsgBox oSheet.Cells(2, 3).Value HTH, Bernie MS Excel MVP "itstome" wrote in message ... I am having the following code: oSheet.Cells(2,3).Select msgbox oSheet.Cells(2,3).value Msgbox ActiveCell.Value The cell is having value, but still, its giving the following error: Error Description: Object Required 'ActiveCell' i did the following also: msgbox activecell but its giving me a blank messagebox Please someone help me out in this . Thanks in advance -- itstome ------------------------------------------------------------------------ itstome's Profile: http://www.excelforum.com/member.php...o&userid=26787 View this thread: http://www.excelforum.com/showthread...hreadid=400413 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ActiveCell giving blank value | New Users to Excel | |||
Counting blank and filled cells within a range. | Excel Discussion (Misc queries) | |||
How to delete blank rows | Excel Discussion (Misc queries) | |||
blank cells | Excel Discussion (Misc queries) | |||
VLOOKUP, OFFSET, MATCH PROBLEM, HELP? | Excel Worksheet Functions |