Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

copying function each row

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Copying a function for each row in a table

Copying a function for each row in a table

ResolvedVersion 2007

Steven has attended:
Access Intermediate course

Copying a function for each row in a table

Hi,

I am trying to add some functions to a table at the press of a button to prepare it for DB import. The functions must copy down to the last row of the table which is variable.

Everything works fine until i exceed 30,000 rows and then i receive 'error 6' Overflow.

I have only tested this with the one function and for information I am taking the last three characters of a user ID as this is the unique section.

I have declared the function as a string as it contains letters and numerals.

Please see code below, i have commented out the line i wished to use and hard-coded a number which works fine until it exceeds 30k rows.

Sub addID()
intTargetRowCount = 2

For intRowCount = 1 To 100
'Sheets("Data").Range("A2").CurrentRegion.Rows.Count

Sheets("Data").Cells(intTargetRowCount, 11) = _
muws_id(Sheets("Data").Cells(intTargetRowCount, 1))

intTargetRowCount = intTargetRowCount + 1

Next intRowCount
End Sub

Any help on this error would be appriciated.

RE: Copying a function for each row in a table

**Resolved**

My variables that were declared as Integer had to be declared as Long.

All works as expected now.

Best Regards
Steve

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Percentage format

Ctrl+Shift+% applies the Percentage format, with no decimal places.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.