Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear All,
My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. thanks in advance! -- sisco98 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Roedd <<sisco98 wedi ysgrifennu:
My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. range("B4").value = range("B4").value +1 as the last line of your macro? -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
it seems good solution, thank you for it, but if I write it into my macro and run it, I receive type mismatch error message. If I delete + and 1 at the end of the line, i don't get error, but this way is pointless of course:-) would you have some advice for me about this case? Last time I didn't write, but I think you found out that I'm not professional VBA user... -- sisco98 "Robert Bruce" wrote: Roedd <<sisco98 wedi ysgrifennu: My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. range("B4").value = range("B4").value +1 as the last line of your macro? -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are you using Excel 97. In any event
The only thing I can think of is that B4 doesn't currently hold a number - perhaps a space. You could manually clear it out, or you could protect for that situation in your code. if not isnumeric(Range("B4").Value) then Range("B4").Value = 1 else Range("B4").Value = Range("B4").Value + 1 end if -- Regards, Tom Ogilvy "sisco98" wrote in message ... Hi, it seems good solution, thank you for it, but if I write it into my macro and run it, I receive type mismatch error message. If I delete + and 1 at the end of the line, i don't get error, but this way is pointless of course:-) would you have some advice for me about this case? Last time I didn't write, but I think you found out that I'm not professional VBA user... -- sisco98 "Robert Bruce" wrote: Roedd <<sisco98 wedi ysgrifennu: My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. range("B4").value = range("B4").value +1 as the last line of your macro? -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thank you very much. for now, ihave realized that the problem was that the
commandbutton was not on the page where the modifiable cell. i still don't know why didn't work, even if i selected the proper page in the macro. anyhow, for now i created an other commandbutton on the "I4" cell's page and now works properly with all mentioned methods. I would like to leave a good feedback for your help, but i don't find where could i do.:-( thanks again! -- sisco98 "Tom Ogilvy" wrote: Are you using Excel 97. In any event The only thing I can think of is that B4 doesn't currently hold a number - perhaps a space. You could manually clear it out, or you could protect for that situation in your code. if not isnumeric(Range("B4").Value) then Range("B4").Value = 1 else Range("B4").Value = Range("B4").Value + 1 end if -- Regards, Tom Ogilvy "sisco98" wrote in message ... Hi, it seems good solution, thank you for it, but if I write it into my macro and run it, I receive type mismatch error message. If I delete + and 1 at the end of the line, i don't get error, but this way is pointless of course:-) would you have some advice for me about this case? Last time I didn't write, but I think you found out that I'm not professional VBA user... -- sisco98 "Robert Bruce" wrote: Roedd <<sisco98 wedi ysgrifennu: My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. range("B4").value = range("B4").value +1 as the last line of your macro? -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
if you want to refer to a different sheet in a sheet module, just qualify
your range: With Worksheets("Sheet3") .Range("B4").Value = .Range("B4").Value + 1 End With This forum (Usenet) is like a street corner. Anyone can come and talk. There is no need for or provision for ratings or points or anything like that (unless you go through the MS communities - then I can't say for those). -- Regards, Tom Ogilvy "sisco98" wrote in message ... thank you very much. for now, ihave realized that the problem was that the commandbutton was not on the page where the modifiable cell. i still don't know why didn't work, even if i selected the proper page in the macro. anyhow, for now i created an other commandbutton on the "I4" cell's page and now works properly with all mentioned methods. I would like to leave a good feedback for your help, but i don't find where could i do.:-( thanks again! -- sisco98 "Tom Ogilvy" wrote: Are you using Excel 97. In any event The only thing I can think of is that B4 doesn't currently hold a number - perhaps a space. You could manually clear it out, or you could protect for that situation in your code. if not isnumeric(Range("B4").Value) then Range("B4").Value = 1 else Range("B4").Value = Range("B4").Value + 1 end if -- Regards, Tom Ogilvy "sisco98" wrote in message ... Hi, it seems good solution, thank you for it, but if I write it into my macro and run it, I receive type mismatch error message. If I delete + and 1 at the end of the line, i don't get error, but this way is pointless of course:-) would you have some advice for me about this case? Last time I didn't write, but I think you found out that I'm not professional VBA user... -- sisco98 "Robert Bruce" wrote: Roedd <<sisco98 wedi ysgrifennu: My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. range("B4").value = range("B4").value +1 as the last line of your macro? -- Rob http://www.asta51.dsl.pipex.com/webcam/ This message is copyright Robert Bruce and intended for distribution only via NNTP. Dissemination via third party Web forums with the exception of Google Groups and Microsoft Communities is strictly prohibited and may result in legal action. |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Try this code: Dim oldValue as Integer oldValue = Range("B4").Value Range("B4").Value = oldValue + 1 -- http://blog.jausovec.net "sisco98" je napisal: Dear All, My problem is that I 'd like that the excel would counting the number of runs of a macro in a certain cell. For example, there is the cell "B4" with number 1. I run a macro and when it's ended, the valu of "B4" cell is increasing by 1 and it will be 2. thanks in advance! -- sisco98 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Why macro runs on the same sheet? | Excel Discussion (Misc queries) | |||
One macro runs then it auto runs another macro | Excel Discussion (Misc queries) | |||
Which Macro Runs...? | Excel Discussion (Misc queries) | |||
Macro Runs if Template name is ..... | Excel Programming |