Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Type mismatch error on Find

I am attempting to find a cell in a column that contains a certain
string, starting from a known location. Here's what I have done so far:

Sub OrganizeSummary()

Dim sBegRange As String
Dim sEndRange As String
Dim rFoundCell As Range
Dim rTable As Range
Dim sHeading As String
Dim sPhase1 As String
Dim sPhase2 As String
Dim vFindResult As Variant

Sheets("Summary").Select

'First, sort the current data
Range("A17", "I65536").Select
Selection.Sort Key1:=Range("B16"), Key2:=Range("A16"),
Key3:=Range("H16")

'Now start creating groupings
'First projects launched since last week
sHeading = "Projects Launched Since Last Week"
sPhase1 = "1-Launched w/Actuals"

Range("B16").Select
Set rFoundCell = ActiveCell
Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
If rFoundCell Is Nothing Then
ActiveCell.Offset(1, -1).Select
ActiveCell.EntireRow.Insert
ActiveCell.Formula = "None"
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
Else
rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
End If

Range("A15").Select

End Sub

As I step through the code, when I get to:

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate

I get Run-time error '13': Type mismatch

I already have a reference to MS VBA Extensibility 5.3, as recommended
in other postings related to this issue. Any other suggestions? Thanks!
- Pat

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Type mismatch error on Find

Lose the .Activate in this statement.

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)



wrote:

I am attempting to find a cell in a column that contains a certain
string, starting from a known location. Here's what I have done so far:

Sub OrganizeSummary()

Dim sBegRange As String
Dim sEndRange As String
Dim rFoundCell As Range
Dim rTable As Range
Dim sHeading As String
Dim sPhase1 As String
Dim sPhase2 As String
Dim vFindResult As Variant

Sheets("Summary").Select

'First, sort the current data
Range("A17", "I65536").Select
Selection.Sort Key1:=Range("B16"), Key2:=Range("A16"),
Key3:=Range("H16")

'Now start creating groupings
'First projects launched since last week
sHeading = "Projects Launched Since Last Week"
sPhase1 = "1-Launched w/Actuals"

Range("B16").Select
Set rFoundCell = ActiveCell
Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
If rFoundCell Is Nothing Then
ActiveCell.Offset(1, -1).Select
ActiveCell.EntireRow.Insert
ActiveCell.Formula = "None"
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
Else
rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
End If

Range("A15").Select

End Sub

As I step through the code, when I get to:

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate

I get Run-time error '13': Type mismatch

I already have a reference to MS VBA Extensibility 5.3, as recommended
in other postings related to this issue. Any other suggestions? Thanks!
- Pat


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Type mismatch error on Find

I believe the error is caused by the two Set lines conflicting, trying to
work on code for this, I will try to get it back to you ASAP.

" wrote:

I am attempting to find a cell in a column that contains a certain
string, starting from a known location. Here's what I have done so far:

Sub OrganizeSummary()

Dim sBegRange As String
Dim sEndRange As String
Dim rFoundCell As Range
Dim rTable As Range
Dim sHeading As String
Dim sPhase1 As String
Dim sPhase2 As String
Dim vFindResult As Variant

Sheets("Summary").Select

'First, sort the current data
Range("A17", "I65536").Select
Selection.Sort Key1:=Range("B16"), Key2:=Range("A16"),
Key3:=Range("H16")

'Now start creating groupings
'First projects launched since last week
sHeading = "Projects Launched Since Last Week"
sPhase1 = "1-Launched w/Actuals"

Range("B16").Select
Set rFoundCell = ActiveCell
Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
If rFoundCell Is Nothing Then
ActiveCell.Offset(1, -1).Select
ActiveCell.EntireRow.Insert
ActiveCell.Formula = "None"
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
Else
rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
End If

Range("A15").Select

End Sub

As I step through the code, when I get to:

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate

I get Run-time error '13': Type mismatch

I already have a reference to MS VBA Extensibility 5.3, as recommended
in other postings related to this issue. Any other suggestions? Thanks!
- Pat


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Type mismatch error on Find

Dave is absolutely right.

"Dave Peterson" wrote:

Lose the .Activate in this statement.

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)



wrote:

I am attempting to find a cell in a column that contains a certain
string, starting from a known location. Here's what I have done so far:

Sub OrganizeSummary()

Dim sBegRange As String
Dim sEndRange As String
Dim rFoundCell As Range
Dim rTable As Range
Dim sHeading As String
Dim sPhase1 As String
Dim sPhase2 As String
Dim vFindResult As Variant

Sheets("Summary").Select

'First, sort the current data
Range("A17", "I65536").Select
Selection.Sort Key1:=Range("B16"), Key2:=Range("A16"),
Key3:=Range("H16")

'Now start creating groupings
'First projects launched since last week
sHeading = "Projects Launched Since Last Week"
sPhase1 = "1-Launched w/Actuals"

Range("B16").Select
Set rFoundCell = ActiveCell
Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
If rFoundCell Is Nothing Then
ActiveCell.Offset(1, -1).Select
ActiveCell.EntireRow.Insert
ActiveCell.Formula = "None"
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
Else
rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
End If

Range("A15").Select

End Sub

As I step through the code, when I get to:

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate

I get Run-time error '13': Type mismatch

I already have a reference to MS VBA Extensibility 5.3, as recommended
in other postings related to this issue. Any other suggestions? Thanks!
- Pat


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Type mismatch error on Find

Dave was right, of course. Thanks! - Pat

Dave Peterson wrote:
Lose the .Activate in this statement.

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell, _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)



wrote:

I am attempting to find a cell in a column that contains a certain
string, starting from a known location. Here's what I have done so far:

Sub OrganizeSummary()

Dim sBegRange As String
Dim sEndRange As String
Dim rFoundCell As Range
Dim rTable As Range
Dim sHeading As String
Dim sPhase1 As String
Dim sPhase2 As String
Dim vFindResult As Variant

Sheets("Summary").Select

'First, sort the current data
Range("A17", "I65536").Select
Selection.Sort Key1:=Range("B16"), Key2:=Range("A16"),
Key3:=Range("H16")

'Now start creating groupings
'First projects launched since last week
sHeading = "Projects Launched Since Last Week"
sPhase1 = "1-Launched w/Actuals"

Range("B16").Select
Set rFoundCell = ActiveCell
Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate
If rFoundCell Is Nothing Then
ActiveCell.Offset(1, -1).Select
ActiveCell.EntireRow.Insert
ActiveCell.Formula = "None"
ActiveCell.Offset(1, 0).Select
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
Else
rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)
ActiveCell.EntireRow.Insert
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Range(ActiveCell.Address, ActiveCell.Offset(0,
7).Select).Select
Selection.Merge
Selection.HorizontalAlignment = xlLeft
ActiveCell.Formula = sHeading
End If

Range("A15").Select

End Sub

As I step through the code, when I get to:

Set rFoundCell = Columns(1).Find(What:=sPhase1, After:=rFoundCell,
_
LookIn:=xlValues, LookAt:=xlPart,
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False).Activate

I get Run-time error '13': Type mismatch

I already have a reference to MS VBA Extensibility 5.3, as recommended
in other postings related to this issue. Any other suggestions? Thanks!
- Pat


--

Dave Peterson


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
Visual Basic Error Run Time Error, Type Mismatch Meg Partridge Excel Discussion (Misc queries) 12 September 10th 08 06:10 PM
FIND type mismatch error, but don't see it KathyC Excel Worksheet Functions 7 November 14th 06 03:59 PM
Conditional Formatting - Run Time Error '13' Type Mismatch Error ksp Excel Programming 0 July 11th 06 07:06 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Befuddled with For Next Loop ------ Run - Time Error '13' Type Mismatch Error rdavis7408 Excel Programming 1 August 25th 04 03:54 AM


All times are GMT +1. The time now is 03:49 PM.

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"