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 - New to VB, please help

My code is as follows. Please note that I can't get it to run past the first
line so I wouldn't be surprised if it is all be wrong!!

Sub Button2_Click()

Worksheets("Minutes").Activate
For Counter = 0 To UBound(Action1)
If Actions1.Text Then
Actions1.Copy
End If

Next Counter
End Sub

I get a "type mismatch" error on the line:
For Counter = 0 To UBound(Action1)
and i'm unsure what is wrong with it. Action1 is the name I have given to
my range (I just selected the range and named it). What am I doing wrong??

Thanks in Advance...
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Type mismatch error - New to VB, please help

What is "Action1"? For UBound to work, it needs to be an array, but for Text
and Copy, it needs to be a range (I assume).


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Erin Simons" <Erin wrote in message
...
My code is as follows. Please note that I can't get it to run past the
first
line so I wouldn't be surprised if it is all be wrong!!

Sub Button2_Click()

Worksheets("Minutes").Activate
For Counter = 0 To UBound(Action1)
If Actions1.Text Then
Actions1.Copy
End If

Next Counter
End Sub

I get a "type mismatch" error on the line:
For Counter = 0 To UBound(Action1)
and i'm unsure what is wrong with it. Action1 is the name I have given to
my range (I just selected the range and named it). What am I doing
wrong??

Thanks in Advance...


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Type mismatch error - New to VB, please help

Thanks Chip!! I'm very much a novice but your advice helped. A friend
suggested I use UBound, but I'm just using a For Each loop now, much better.

Thanks
E

"Chip Pearson" wrote:

What is "Action1"? For UBound to work, it needs to be an array, but for Text
and Copy, it needs to be a range (I assume).


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"Erin Simons" <Erin wrote in message
...
My code is as follows. Please note that I can't get it to run past the
first
line so I wouldn't be surprised if it is all be wrong!!

Sub Button2_Click()

Worksheets("Minutes").Activate
For Counter = 0 To UBound(Action1)
If Actions1.Text Then
Actions1.Copy
End If

Next Counter
End Sub

I get a "type mismatch" error on the line:
For Counter = 0 To UBound(Action1)
and i'm unsure what is wrong with it. Action1 is the name I have given to
my range (I just selected the range and named it). What am I doing
wrong??

Thanks in Advance...


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
runtime error 13 - type mismatch error in Excel 97 on Citrix Kevin Maher Excel Programming 7 March 8th 08 11:48 AM
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 06:44 PM.

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"