Incremental Numerial Increase in a Merged Cell

Posted on 2010-01-04
Medium Priority
Last Modified: 2013-12-24
I am using the following macro in excel to auto increase a work order number by 1 when the workbook is opened; however, I want to move where the work order number is located in the spreadsheet from cell A1 to a merged cell located at AO4:AR4.  When I change the second line of the macro from ("A1") to (AO4") the macro does not work but instead returns the following error             "Run-time Error '13':
                       Type mismatch

I tried putting replacing A1 with the range A04:AR4, but I get the same error.  I would like to keep this fix very simple if possible by just changing the second line.  Any help would be appreciated.

Sub AutoOpenFunctions()
Selection.Value = Selection.Value + 1
End Sub
Question by:LarryErbe
LVL 59

Accepted Solution

Saurabh Singh Teotia earned 500 total points
ID: 26175438
Use this code Rather...

Sub AutoOpenFunctions()
Range("Ao4").Value = Range("Ao4").Value+ 1
End Sub

Open in new window


Author Comment

ID: 26175676
Perfect!  Thanks for the quick reply as well:)

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question