Hey,
I am having trouble comming up with a macro that if column K has any cells that contain numbers add 1 to that cell. Example if K16=8 after the macro K16=9. but i have many cells with numbers in column K and with text.
Thanks!
Hey,
I am having trouble comming up with a macro that if column K has any cells that contain numbers add 1 to that cell. Example if K16=8 after the macro K16=9. but i have many cells with numbers in column K and with text.
Thanks!
Last edited by Dodge_Caravan23; 04-07-2010 at 01:55 PM.
You can add a number to a range of cells without using VBA.
In a empty cells, type the number you want to add, copy that cell then select the range of cells which are to be increased and choose Paste Special > Add option.
Post back if you really need a VBA solution.
Palmetto
Do you know . . . ?
You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.
Use the IsNumeric function:
Please Login or Register to view this content.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
Hey guys,
Thanks palmetto but i need a macro since I have over a thousand lines. THanks Dave the macro works except all blank cells get +1 also. If i paste a space in all the blank cells it works fine.
after the "then" in the formula can another if be put for "if numeric value >0 then +1"?
Thanks again!
The variable should be declared. Here is amended code per your request.
Please Login or Register to view this content.
Or you could change this line in Dave's macro
toIf IsNumeric(ActiveSheet.Cells(i, "K")) Then
HTHIf IsNumeric(ActiveSheet.Cells(i, “K”)) And ActiveSheet.Cells(i, “K”).Value > 0 Then
Alf
Thanks guys both are the same and both work!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks