Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 1st, 2006, 01:27 AM
Registered User
 
Join Date: Aug 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default EXCEL VBA

Can somebody help me why i kept getting the error msg:

<Method 'Range' of object '_Worksheet' failed>

here is my simple code:

Dim dtRpt As String
Private Sub cmdSPMIS_Click()
    dtRpt = Sheet1.Range(A1).Value
End Sub

that code alone produces the error.
'i will be using the variable dtRpt in restricting when I filter my recordset.

bembem
 
Old September 1st, 2006, 01:56 AM
Registered User
 
Join Date: Aug 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

guys its ok. I just have to enclose the A1 with ""

making it :

dtRpt = Sheet1.Range("A1").Value

*smiles shyly*
bembem





Similar Threads
Thread Thread Starter Forum Replies Last Post
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
New to Excel VBA anukagni Excel VBA 0 June 24th, 2006 05:51 AM
Converting excel data to Access using excel VBA ShaileshShinde VB Databases Basics 1 April 26th, 2006 07:57 AM
VBA Excel jayanp Access VBA 3 December 16th, 2004 03:18 AM
Excel VBA to SQL & back to VBA edesousa Excel VBA 1 June 1st, 2004 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.