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: 79
Default type mismatch

I am a beginner in programming VBA

I want to write a function that returns an array where each element is
increased by 1.

However, something is not working. Could you please help me?

Function b(r As Range)
Dim i As Integer, j As Integer
b = r
For i = 1 To UBound(b, 1)
For j = 1 To UBound(b, 2)
b(i, j) = b(i, j) + 1
Next j
Next i
End Function

For example,

............A..........B
1.........1...........2
2.........2...........3
3.........3...........4

In this case, B1:B3 contains the formula =b(A1:a3) entered with
Ctrl-Shift-Enter

Thank you

 
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
Type Mismatch!!! sbowman Excel Programming 6 July 7th 06 03:10 PM
Type Mismatch: array or user defined type expected ExcelMonkey Excel Programming 4 July 6th 06 03:40 PM
Type mismatch using rnge as Range with Type 8 Input Box STEVE BELL Excel Programming 11 December 3rd 05 05:02 AM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Type mismatch Patti[_5_] Excel Programming 3 May 30th 04 02:44 PM


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