Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
itstome
 
Posts: n/a
Default 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   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveCell giving blank value itstome New Users to Excel 1 August 30th 05 11:01 PM
Counting blank and filled cells within a range. greg7468 Excel Discussion (Misc queries) 3 June 28th 05 10:41 PM
How to delete blank rows John Mansfield Excel Discussion (Misc queries) 3 April 27th 05 11:48 PM
blank cells R.VENKATARAMAN Excel Discussion (Misc queries) 1 April 6th 05 10:25 AM
VLOOKUP, OFFSET, MATCH PROBLEM, HELP? Steve Excel Worksheet Functions 0 January 30th 05 09:11 PM


All times are GMT +1. The time now is 11:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"