Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default macro runs counting

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default macro runs counting

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default macro runs counting

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro runs counting

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default macro runs counting

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default macro runs counting

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default macro runs counting

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs Rruffpaw Setting up and Configuration of Excel 1 September 17th 11 01:25 PM
Why macro runs on the same sheet? Harshad[_2_] Excel Discussion (Misc queries) 1 September 15th 08 09:39 AM
One macro runs then it auto runs another macro PG Excel Discussion (Misc queries) 2 September 1st 06 09:30 PM
Which Macro Runs...? Bill Martin Excel Discussion (Misc queries) 7 September 29th 05 12:42 PM
Macro Runs if Template name is ..... Nigel Downing Excel Programming 5 December 19th 03 03:49 AM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"