Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sai sai is offline
external usenet poster
 
Posts: 10
Default Prevent changes to cells but let user move columns?

Hi,

I have a situation where I would like to control what the user types
into cells of a specific column. But at the same time, since I am
using a ListObject I would like to let the user move columns around by
selecting an entire column and then dragging it another location.

I have code in the workbook's sheet_change event. This event is
triggerred when a cell is changed or a whole column is moved. Is there
a way I can disable the checking of values in cells when a column is
being moved?

Thanks,

Sai

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Prevent changes to cells but let user move columns?

Without knowing all the details of what you are doing I would recommend

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count = 65536 then Exit sub
' existing code
End Sub

--
Regards,
Tom Ogilvy


"sai" wrote in message
oups.com...
Hi,

I have a situation where I would like to control what the user types
into cells of a specific column. But at the same time, since I am
using a ListObject I would like to let the user move columns around by
selecting an entire column and then dragging it another location.

I have code in the workbook's sheet_change event. This event is
triggerred when a cell is changed or a whole column is moved. Is there
a way I can disable the checking of values in cells when a column is
being moved?

Thanks,

Sai



  #3   Report Post  
Posted to microsoft.public.excel.programming
sai sai is offline
external usenet poster
 
Posts: 10
Default Prevent changes to cells but let user move columns?

Tom,

I see the logic of what you are suggesting.

The cells.count is usually much less than 65536 and is variable. But I
can get the cell count I need.

How do I distinguish between a move and say a delete? If the user
selects an entire column and hits delete, I want to be able to prevent
that. I want to allow only a move. Any ideas on how to trap the key
pressed or something like that I can use to judge user intention before
I exit sub?

Thanks for your response.

Sai

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Prevent changes to cells but let user move columns?

If you want to have that type of control, I suggest you fully protect your
sheet and handle all user interactions through Userforms. There is no
direct way to determine what has triggered a change event other than
indirect methods such as scanning through the sheet and making comparisons.

--
Regards,
Tom Ogilvy


"sai" wrote in message
oups.com...
Tom,

I see the logic of what you are suggesting.

The cells.count is usually much less than 65536 and is variable. But I
can get the cell count I need.

How do I distinguish between a move and say a delete? If the user
selects an entire column and hits delete, I want to be able to prevent
that. I want to allow only a move. Any ideas on how to trap the key
pressed or something like that I can use to judge user intention before
I exit sub?

Thanks for your response.

Sai



  #5   Report Post  
Posted to microsoft.public.excel.programming
sai sai is offline
external usenet poster
 
Posts: 10
Default Prevent changes to cells but let user move columns?

Thanks Tom.
Is there a way to trap which key was pressed on a sheet?

Sai



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Prevent changes to cells but let user move columns?

Only if you want to assign specific keys to execute macros

See OnKey in Excel VBA help.

--
Regards,
Tom Ogilvy


"sai" wrote in message
ups.com...
Thanks Tom.
Is there a way to trap which key was pressed on a sheet?

Sai



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
Prevent user from using Name Matlock Excel Discussion (Misc queries) 5 March 13th 08 04:58 AM
My arrow keys won't move between cells only rows & columns Deebo Excel Discussion (Misc queries) 1 August 14th 07 04:23 PM
Prevent User Seeing Data in Hidden Columns Louise Excel Discussion (Misc queries) 1 October 9th 06 04:01 PM
Prevent User from saving crapit Excel Programming 2 July 26th 04 03:48 PM
How do I: prevent user from scolling down and right? jasonsweeney[_39_] Excel Programming 3 February 5th 04 07:06 PM


All times are GMT +1. The time now is 03:28 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"