Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default 2 Part Question

Hello from Steved

1st Question

Is it possible to to a selected folder and have
a macro to open and close every workbook in that folder.

2nd question

The 1st question needs to be yes.

Can the macro have a formula in it that will allow
"find" as an example "the value would be 4444"
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 2 Part Question

Steved,

Try something like

Dim FName As String
Dim FoundCell as Range
Dim WB As Workbook
ChDrive "C:" '<<< CHANGE
ChDir "C:\Test" '<<< CHANGE
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Find(what:="the value is
444")
If Not FoundCell Is Nothing Then
' do something with FoundCell
Else
' not found
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Steved" wrote in message
...
Hello from Steved

1st Question

Is it possible to to a selected folder and have
a macro to open and close every workbook in that folder.

2nd question

The 1st question needs to be yes.

Can the macro have a formula in it that will allow
"find" as an example "the value would be 4444"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 76
Default 2 Part Question

Firstly Thankyou

I am receiving this error

Object doesn't support this property or this method

It will open the first file then the above error
Am I not understanding something here.

Sub Tests()

Dim FName As String
Dim FoundCell As Range
Dim WB As Workbook
ChDrive "C:" '<<< CHANGE
ChDir "C:\Wtt" '<<< CHANGE
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Find(what:="the
value is 2402")
If Not FoundCell Is Nothing Then
' do something with FoundCell
Else
' not found
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop

End Sub





Dim FName As String
Dim FoundCell as Range
Dim WB As Workbook
ChDrive "C:" '<<< CHANGE
ChDir "C:\Test" '<<< CHANGE
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Find(what:="the

value is
444")
If Not FoundCell Is Nothing Then
' do something with FoundCell
Else
' not found
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Steved" wrote in

message
...
Hello from Steved

1st Question

Is it possible to to a selected folder and have
a macro to open and close every workbook in that

folder.

2nd question

The 1st question needs to be yes.

Can the macro have a formula in it that will allow
"find" as an example "the value would be 4444"



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default 2 Part Question

Steved,

Set FoundCell = WB.Worksheets(1).Find(what:="the

should be

Set FoundCell = WB.Worksheets(1).Cells.Find(what:="the



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Steved" wrote in message
...
Firstly Thankyou

I am receiving this error

Object doesn't support this property or this method

It will open the first file then the above error
Am I not understanding something here.

Sub Tests()

Dim FName As String
Dim FoundCell As Range
Dim WB As Workbook
ChDrive "C:" '<<< CHANGE
ChDir "C:\Wtt" '<<< CHANGE
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Find(what:="the
value is 2402")
If Not FoundCell Is Nothing Then
' do something with FoundCell
Else
' not found
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop

End Sub





Dim FName As String
Dim FoundCell as Range
Dim WB As Workbook
ChDrive "C:" '<<< CHANGE
ChDir "C:\Test" '<<< CHANGE
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
Set FoundCell = WB.Worksheets(1).Find(what:="the

value is
444")
If Not FoundCell Is Nothing Then
' do something with FoundCell
Else
' not found
End If
WB.Close SaveChanges:=True ' or False
FName = Dir()
Loop


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Steved" wrote in

message
...
Hello from Steved

1st Question

Is it possible to to a selected folder and have
a macro to open and close every workbook in that

folder.

2nd question

The 1st question needs to be yes.

Can the macro have a formula in it that will allow
"find" as an example "the value would be 4444"



.



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
2 part lookup question CP Excel Worksheet Functions 5 September 2nd 09 10:29 AM
2 part ranking question pgarcia Excel Discussion (Misc queries) 1 November 29th 07 12:10 AM
Excel If Then Question - Part 2 [email protected][_2_] Excel Discussion (Misc queries) 3 October 12th 07 08:20 PM
Automation 2-Part Question... Bob Barnes Excel Discussion (Misc queries) 0 March 26th 06 11:54 PM
2 part question on averaging Geo Excel Discussion (Misc queries) 4 January 2nd 05 10:35 PM


All times are GMT +1. The time now is 01:57 AM.

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

About Us

"It's about Microsoft Excel"