Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default I need a macro to run on a set condition

I have a macro assigned to an enter button on a spreadsheet. When the enter
button is pushed, data entered into row 1 (the data entry cell) is moved to
row 2 and so on until row 6. Rows 2 to 6 are locked out to prevent anyone
from accidentally deleting or overwriting data in those rows. I would like a
condition set that when data gets to row 6, the last row, a message box
informs that the list is full. And at that point when the enter button is
clicked the original macro does not run until the list is deleted. I do have
a macro for the deletion part.
Please help.....
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 471
Default I need a macro to run on a set condition

Place a line of code in the macro that runs when they click the button before
anything happens:
if cells(6,1).value<empty then
msgbox(prompt:="You may Not enter anything else, the file is full!",
title:="Entry Not Allowed", buttons:=Vbcritical)
goto theend
end if

Then place a marker at the bottom:

TheEnd:
end sub
"Savuti" wrote:

I have a macro assigned to an enter button on a spreadsheet. When the enter
button is pushed, data entered into row 1 (the data entry cell) is moved to
row 2 and so on until row 6. Rows 2 to 6 are locked out to prevent anyone
from accidentally deleting or overwriting data in those rows. I would like a
condition set that when data gets to row 6, the last row, a message box
informs that the list is full. And at that point when the enter button is
clicked the original macro does not run until the list is deleted. I do have
a macro for the deletion part.
Please help.....

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default I need a macro to run on a set condition

I beleive that best thing is to give those protected rows a range name. In
this case you can not retrict with top 6 rows. Instead you can allow the
users to add more rows if they required.

In code where you are using 'Enter functionality' check if the current
cursor is jump into Named range area then give message and place the cursor
back to it's last original positon

--
Malik


"Savuti" wrote:

I have a macro assigned to an enter button on a spreadsheet. When the enter
button is pushed, data entered into row 1 (the data entry cell) is moved to
row 2 and so on until row 6. Rows 2 to 6 are locked out to prevent anyone
from accidentally deleting or overwriting data in those rows. I would like a
condition set that when data gets to row 6, the last row, a message box
informs that the list is full. And at that point when the enter button is
clicked the original macro does not run until the list is deleted. I do have
a macro for the deletion part.
Please help.....

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default I need a macro to run on a set condition

Hi Mike, I appreciate the help. Just so I am on the same page, do I place the
code that you gave before the start of my existing code - which is:

Range("B9:I16").Select
ActiveSheet.Unprotect


Also what does - Then place a marker at the bottom - mean

I am pretty much a beginner at this

Thanks

"Mike H." wrote:

Place a line of code in the macro that runs when they click the button before
anything happens:
if cells(6,1).value<empty then
msgbox(prompt:="You may Not enter anything else, the file is full!",
title:="Entry Not Allowed", buttons:=Vbcritical)
goto theend
end if

Then place a marker at the bottom:

TheEnd:
end sub
"Savuti" wrote:

I have a macro assigned to an enter button on a spreadsheet. When the enter
button is pushed, data entered into row 1 (the data entry cell) is moved to
row 2 and so on until row 6. Rows 2 to 6 are locked out to prevent anyone
from accidentally deleting or overwriting data in those rows. I would like a
condition set that when data gets to row 6, the last row, a message box
informs that the list is full. And at that point when the enter button is
clicked the original macro does not run until the list is deleted. I do have
a macro for the deletion part.
Please help.....

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
Macro if condition puiuluipui Excel Discussion (Misc queries) 5 November 13th 09 12:07 PM
use more than 4 condition in cf without using macro Montu Excel Worksheet Functions 3 November 15th 07 03:19 PM
Run Macro until a condition is met tx12345[_12_] Excel Programming 2 February 14th 06 01:02 AM
run macro only if condition is met Nikonov Excel Programming 2 November 8th 05 05:38 PM
macro to run only under certain condition - how? Orion[_2_] Excel Programming 2 December 22nd 04 10:08 AM


All times are GMT +1. The time now is 10:35 AM.

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

About Us

"It's about Microsoft Excel"