Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run time error '91' when clicking on text field 1

Status
Not open for further replies.

aburamewolf

Technical User
Oct 12, 2011
18
US
Hi I'm new to VBA, I've been trying to fix the error I'm getting when creating a user form in excel, but I'm kind of stuck, the code is presented below.

What the macro should do is, once I click on inotes.text it should automatically use the "ifind" variable to search through the sheet for the account number typed on ian.text and with this obtain the row number of where the account number is.

Once I have the row number, I know if it's already listed or not, if it's listed it should pull the notes that were typed in for that customer number and create two line breaks and a time stamp on inotes.text

if not then it should time stamp inotes.text.

however it keeps coming with an run time

"error '91':

Object variable or With block variable not set"

Could someone help me see where my mistake is?

Thanks in advance!

Here's the code I have so far:

Private Sub inotes_Enter()

Sheets("inbound").Activate
ActiveCell = Cells(1, 1)

Dim timestamp As Variant
Dim x1 As Variant
Dim ifind As Variant

timestamp = Format(Now, "mmm ddd dd yyyy hh:mm:ss AM/PM")

If ian.Text <> "" Then
ifind = Cells.find(what:=ian.Text, after:=ActiveCell)
If IsEmpty(ifind) = True Then
ifind = 1
inotes = timestamp + ""
Else
ifind = Cells.find(what:=ian.Text, after:=ActiveCell).Row
inotes = Cells(ifind, 10) + (Chr(10)) + (Chr(10)) + timestamp
End If
End If
End Sub

 
You might get a better response if you ask this in forum707. This forum is for VB5/6, which is not the same as VBA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top