copying function each row

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

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

Copying a function for each row in a table | Excel forum

resolvedResolved · Medium Priority · Version 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:

How to select certain data in an Excel 2010 workbook

If you want to select the correct data set in a page full of data, the most accurate and efficient way of doing this is to use the ''Shift and Click'' technique.

For example: If you want to select all data in cells A2 to E10, then click on cell A2, hold down the Shift key and click on cell E10 and all the data you want to see is highlighted.

Keep holding down the Shift key and you can move from cell E10 to any other cell in the spreadsheet.

View all Excel hints and tips


Server loaded in 0.08 secs.