Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 24th, 2009, 03:38 AM
Authorized User
Join Date: Jul 2009
Posts: 30
Thanks: 10
Thanked 0 Times in 0 Posts
Question How to assign a value for cell

I Have a warning Variable 'cell' is used before it has been assigned a value. A null reference exception could result at runtime.
I tried to fix this with the code 'AddHandler(cell.Value)' but it did not work
Please can I have some help
Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
Dim Forms As New Form1
Globals.ThisWorkbook.Sheets.Equals("A2:H5000").ToS tring()

Dim ThisWorkBook As String
Dim Combotext As String
Dim ListText As String
Dim startDate As Date
Dim endDate As Date
Dim name As String
Dim site As String
Dim range As Excel.Range

startDate = cmbStartDate.ValueMember
endDate = cmbEndDate.ValueMember
name = cmbEmployee.ValueMember
site = cmbSiteReference.ValueMember

If cmbStartDate.ValueMember = "" Or cmbEndDate.ValueMember = "" Or cmbEmployee.ValueMember = "" Or cmbSiteReference.ValueMember = "" Then
MsgBox("Make sure you select all values from drop downs", vbCritical, "Missing Values Error")
Exit Sub
End If

'Dim extra_hours As Long
' To account for total hours worked by the person in given time
Dim total_hours As Long
total_hours = 0
'extra_hours = 0
Dim i As Long
Dim Count, count2 As Long
Count = 0
count2 = 2
' sheet2.Cells(1, 2).Value = "test"
'Application.ScreenUpdating = False

'Application.ScreenUpdating = False
'MsgBox ActiveSheet.name
Dim checkBox1 As New CheckBox
For i = 2 To 65536
Dim cell As Excel.Range
If checkBox1.Checked = True Then
If cell(i, 1).Value >= startDate And cell(i, 1).Value <= endDate And cell(i, 2).Value = name And cell(i, 3).Value = site Then
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Separating a CSV cell into 1 value per cell bigtonyicu Excel VBA 2 March 14th, 2008 12:28 PM
I need to refer a cell within a cell like =RC[ RC2 chakravarthi_os Excel VBA 1 September 24th, 2006 08:19 AM
if the cell content is a part of another cell cont sriramus Excel VBA 1 November 15th, 2005 10:20 AM
Use VBA to assign cell values eric_winters Excel VBA 2 September 3rd, 2004 02:27 PM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM

All times are GMT -4. The time now is 09:40 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.