Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Simple "Left" Problem

Hi everyone


I have a long Macro in one of my excel file and I am getting an object
defined error.

" Searchvalue = .Left(Range("A" & sh2rowcount), 9) "

I wanted my searchvaule to be left of that range. This is just a part
of my code and everything looks good except that line.

Where do I insert Left ? in order to search first 9 values of
Range("A" & sh2rowcount)??

Please help

Thank you,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Simple "Left" Problem

Try this:

Searchvalue = .Left(Range("A" & CSTR(sh2rowcount)), 9)

I assume SH2ROWCOUNT is an integer and not a string?
Cheers

On Jul 13, 9:45*pm, James8309 wrote:
Hi everyone

I have a long Macro in one of my excel file and I am getting an object
defined error.

" Searchvalue = .Left(Range("A" & sh2rowcount), 9) "

I wanted my searchvaule to be left of that range. This is just a part
of my code and everything looks good except that line.

Where do I insert Left ? in order to search first 9 values of
Range("A" & sh2rowcount)??

Please help

Thank you,


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default Simple "Left" Problem

On Jul 14, 10:45*am, James8309 wrote:
Hi everyone

I have a long Macro in one of my excel file and I am getting an object
defined error.

" Searchvalue = .Left(Range("A" & sh2rowcount), 9) "

I wanted my searchvaule to be left of that range. This is just a part
of my code and everything looks good except that line.

Where do I insert Left ? in order to search first 9 values of
Range("A" & sh2rowcount)??

Please help

Thank you,


Hi,

I tried adding cstr but still created an object error.



With Workbooks("513 Report.xls").Sheets("MF Lookup Phase2 - 10Digit")
sh2rowcount = 3
sh7rowcount = 3

Do While .Range("A" & sh2rowcount) < ""
Searchvalue = .Left(Range("A" & CStr(sh2rowcount)), 9)
Set c = SearchRange3.Find(what:=Searchvalue, LookIn:=xlValues,
lookat:=xlWhole)
If c Is Nothing Then
With Workbooks("513 Report.xls").Sheets("MF Lookup Phase 2.1 -
10Digit")
.Range("A" & sh7rowcount) = "'" & Searchvalue
sh7rowcount = sh7rowcount + 1
End With
Else
.Range("B" & sh2rowcount) = c.Offset(0, 2)
.Range("C" & sh2rowcount) = c.Offset(0, 3)
End If
sh2rowcount = sh2rowcount + 1
Loop
End With
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple "Left" Problem

Do you have Searchvalue Dim'med as a Range (or some other object)?

Also, why do you show a 'dot' in front of the Left function?

Rick


"James8309" wrote in message
...
Hi everyone


I have a long Macro in one of my excel file and I am getting an object
defined error.

" Searchvalue = .Left(Range("A" & sh2rowcount), 9) "

I wanted my searchvaule to be left of that range. This is just a part
of my code and everything looks good except that line.

Where do I insert Left ? in order to search first 9 values of
Range("A" & sh2rowcount)??

Please help

Thank you,


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
I have a problem with "LEFT" formula a-frustrated-excel-user Excel Discussion (Misc queries) 8 December 20th 06 05:44 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Problem: Worksheets("New Style 2006").Unprotect Password:="naPrint" Karoo News[_2_] Excel Programming 1 January 30th 06 02:40 PM
Conflict with "Right" / "Left" Command DJB[_7_] Excel Programming 4 August 31st 05 10:50 PM


All times are GMT +1. The time now is 08:02 AM.

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

About Us

"It's about Microsoft Excel"