Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple Error Checking


Hi

I have several macros associated with a worksheet, these macro's
perform various simple functions, eg. insert rows, move rows up/down
etc.

What I would like is to know how to word error checking so that

Rows cannot be moved above Row 7. (Rows 1-6 contain headings so I do
not want a row 7 and Row 6 switched by running this macro.
Rows 1-6 cannot deleted.

Something along the lines of "If Activecell < A7 Then ErrorMessage"
etc.

Any ideas?

Apologies if not clear.

Regards
Andy


--
AndyR
------------------------------------------------------------------------
AndyR's Profile: http://www.excelforum.com/member.php...o&userid=15203
View this thread: http://www.excelforum.com/showthread...hreadid=470669

  #2   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default Simple Error Checking

Sub Top6Rows()
If ActiveCell.Row < 7 Then
MsgBox ("Not permitted")
End If
End Sub

An easier alternative might be to unlock rows 6 &below, then protect the
worksheet.

--
Ian
--
"AndyR" wrote in
message ...

Hi

I have several macros associated with a worksheet, these macro's
perform various simple functions, eg. insert rows, move rows up/down
etc.

What I would like is to know how to word error checking so that

Rows cannot be moved above Row 7. (Rows 1-6 contain headings so I do
not want a row 7 and Row 6 switched by running this macro.
Rows 1-6 cannot deleted.

Something along the lines of "If Activecell < A7 Then ErrorMessage"
etc.

Any ideas?

Apologies if not clear.

Regards
Andy


--
AndyR
------------------------------------------------------------------------
AndyR's Profile:
http://www.excelforum.com/member.php...o&userid=15203
View this thread: http://www.excelforum.com/showthread...hreadid=470669



  #3   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Simple Error Checking

Sub SwapRows(FirstRow as long, SecondRow as long)
if firstrow<=6 or secondrow<=6 then
msgbox "Can't move title rows!"
exit sub
end if
'your code to swap the rows
end sub

"AndyR" wrote:


Hi

I have several macros associated with a worksheet, these macro's
perform various simple functions, eg. insert rows, move rows up/down
etc.

What I would like is to know how to word error checking so that

Rows cannot be moved above Row 7. (Rows 1-6 contain headings so I do
not want a row 7 and Row 6 switched by running this macro.
Rows 1-6 cannot deleted.

Something along the lines of "If Activecell < A7 Then ErrorMessage"
etc.

Any ideas?

Apologies if not clear.

Regards
Andy


--
AndyR
------------------------------------------------------------------------
AndyR's Profile: http://www.excelforum.com/member.php...o&userid=15203
View this thread: http://www.excelforum.com/showthread...hreadid=470669


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
Error checking jason2444 Excel Discussion (Misc queries) 3 August 28th 07 09:29 PM
How do I set up a simple checking book worksheet Stargazer Excel Worksheet Functions 1 July 10th 07 05:42 PM
Checking to see that a CHART exists prior to running a simple command Anton Excel Discussion (Misc queries) 0 August 29th 06 06:30 AM
Error Checking mworth01 Excel Discussion (Misc queries) 1 May 18th 06 08:45 PM
Checking for duplicates - think this is simple [email protected] Excel Discussion (Misc queries) 9 February 27th 06 09:32 PM


All times are GMT +1. The time now is 09:10 PM.

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"