LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Complie Error with xlValues


Hi Folks,

I am new to the Whole VBA Programming and I am trying to insert
autofilter condition in a row, when a particluar string in th
worksheet is identified.

All I am getting is an error in the Find method ,when I reac
LookIn:= xlvalues. It give me the following

compile error:
Variable not defined

I am not sure, how to fix this error. I tried various options, but I a
not able to fix this issue.

Here is the code i am working on:


PHP code
-------------------
Sub formatWorkbook(xlApp As Object, filename As String)
'format the workbook
Dim xlWkbk As Object
Dim sheet As Object
Dim i As Variant
Dim test As Variant
Dim TopLeftCell As String
Dim UsdRng As String
Dim BottomRightCell As String
Dim FilterRange As String
Dim Findfor As String

Findfor = "Cust Master ID"
Set xlWkbk = xlApp.Workbooks.Open(filename) 'open the workbook

For i = 1 To xlWkbk.worksheets.Count
Set sheet = xlWkbk.sheets(i)
TopLeftCell = sheet.Range("A:A").Find(what:=Findfor, Lookin:=xlvalues).Address
UsdRng = sheet.UsedRange.Address
BottomRightCell = Right(UsdRng, Len(UsdRng) - InStr(UsdRng, ":"))
FilterRange = TopLeftCell & ":" & BottomRightCell
sheet.Range(FilterRange).AutoFilter
sheet.Range("A1").Select
Next i

xlWkbk.Save 'save the workbook
xlWkbk.Close 'close the workbook

Set xlWkbk = Nothing

End Sub 'formatWorkboo
-------------------


Any helps or suggestions would be appreciated.

Thank You

--
vincent_veg
-----------------------------------------------------------------------
vincent_vega's Profile: http://www.excelforum.com/member.php...fo&userid=3639
View this thread: http://www.excelforum.com/showthread.php?threadid=56175

 
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
VB Complie error - can You Help Anthony Excel Programming 2 October 9th 05 10:51 PM
Complie Error Help JMay Excel Programming 4 January 24th 05 04:33 AM
complie error brian Excel Programming 2 December 13th 04 06:51 PM
Complie Error chris huber Excel Programming 3 January 14th 04 09:57 AM
Variable produces a complie error Btinker Excel Programming 1 November 26th 03 07:53 PM


All times are GMT +1. The time now is 02:17 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"