Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old January 4th 10, 10:45 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2007
Posts: 35
Default VBA Code User Range Selection

I have a current VBA and I would like to extend it to do the following after
the last command:-
allow a user to select a un pretermined range for deletion (could be any
number of coumns and rows) and for the macro to delete that range and either
restart the macro to continue with it's next command or alternatively to stop
via perhaps a message box instruction for the user .

--
hopalong

  #2   Report Post  
Old January 4th 10, 10:55 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2007
Posts: 11,501
Default VBA Code User Range Selection

Hi,

Try this, when the input box pops up simply drag to select a range

Set deleterange = Application.InputBox(prompt:="Select a range of cells",
Type:=8)

Mike

"jimbo" wrote:

I have a current VBA and I would like to extend it to do the following after
the last command:-
allow a user to select a un pretermined range for deletion (could be any
number of coumns and rows) and for the macro to delete that range and either
restart the macro to continue with it's next command or alternatively to stop
via perhaps a message box instruction for the user .

--
hopalong

  #3   Report Post  
Old January 4th 10, 11:50 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2007
Posts: 35
Default VBA Code User Range Selection

Mike hi thanks for replying. Your suggestion works fine up to displaying a
message box and allows the user to select the range. However if the user
selects OK in the message box is does not delete the selected range. Can you
help further?

Many thanks
--
hopalong


"Mike H" wrote:

Hi,

Try this, when the input box pops up simply drag to select a range

Set deleterange = Application.InputBox(prompt:="Select a range of cells",
Type:=8)

Mike

"jimbo" wrote:

I have a current VBA and I would like to extend it to do the following after
the last command:-
allow a user to select a un pretermined range for deletion (could be any
number of coumns and rows) and for the macro to delete that range and either
restart the macro to continue with it's next command or alternatively to stop
via perhaps a message box instruction for the user .

--
hopalong

  #4   Report Post  
Old January 4th 10, 12:13 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Apr 2007
Posts: 11,501
Default VBA Code User Range Selection

Hi,

Like this

Set DeleteRange = Application.InputBox(prompt:="Select a range of cells",
Type:=8)
DeleteRange.ClearContents

Mike

"jimbo" wrote:

Mike hi thanks for replying. Your suggestion works fine up to displaying a
message box and allows the user to select the range. However if the user
selects OK in the message box is does not delete the selected range. Can you
help further?

Many thanks
--
hopalong


"Mike H" wrote:

Hi,

Try this, when the input box pops up simply drag to select a range

Set deleterange = Application.InputBox(prompt:="Select a range of cells",
Type:=8)

Mike

"jimbo" wrote:

I have a current VBA and I would like to extend it to do the following after
the last command:-
allow a user to select a un pretermined range for deletion (could be any
number of coumns and rows) and for the macro to delete that range and either
restart the macro to continue with it's next command or alternatively to stop
via perhaps a message box instruction for the user .

--
hopalong

  #5   Report Post  
Old January 4th 10, 01:02 PM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jan 2007
Posts: 35
Default VBA Code User Range Selection

Mike thanks for your support works great.


--
hopalong


"Mike H" wrote:

Hi,

Like this

Set DeleteRange = Application.InputBox(prompt:="Select a range of cells",
Type:=8)
DeleteRange.ClearContents

Mike

"jimbo" wrote:

Mike hi thanks for replying. Your suggestion works fine up to displaying a
message box and allows the user to select the range. However if the user
selects OK in the message box is does not delete the selected range. Can you
help further?

Many thanks
--
hopalong


"Mike H" wrote:

Hi,

Try this, when the input box pops up simply drag to select a range

Set deleterange = Application.InputBox(prompt:="Select a range of cells",
Type:=8)

Mike

"jimbo" wrote:

I have a current VBA and I would like to extend it to do the following after
the last command:-
allow a user to select a un pretermined range for deletion (could be any
number of coumns and rows) and for the macro to delete that range and either
restart the macro to continue with it's next command or alternatively to stop
via perhaps a message box instruction for the user .

--
hopalong



  #6   Report Post  
Old January 5th 10, 02:31 AM posted to microsoft.public.excel.misc
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2006
Posts: 7,247
Default VBA Code User Range Selection


range for deletion

Be careful when using the word "delete". Strictly speaking, it means
to remove the range from the worksheet and shifting the appropriate
rows and columns upwards and to the left. If you merely want to remove
the content of the cells, use the term "clear".

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]


On Mon, 4 Jan 2010 02:45:01 -0800, jimbo
wrote:

I have a current VBA and I would like to extend it to do the following after
the last command:-
allow a user to select a un pretermined range for deletion (could be any
number of coumns and rows) and for the macro to delete that range and either
restart the macro to continue with it's next command or alternatively to stop
via perhaps a message box instruction for the user .



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
Displaying a result based on user selection Emma Excel Discussion (Misc queries) 3 June 9th 09 08:08 PM
Identifying a selection of a selection of a range swimfast Excel Worksheet Functions 1 March 1st 07 02:51 AM
Calculate average based on user selection William Excel Discussion (Misc queries) 2 January 16th 07 06:16 PM
Hiding worksheets based on user selection HL Excel Worksheet Functions 3 October 12th 06 04:01 PM
Generate a value from user selection in list box. Sol Excel Discussion (Misc queries) 2 September 8th 06 09:03 PM


All times are GMT +1. The time now is 02:41 AM.

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

About Us

"It's about Microsoft Excel"

 

Copyright © 2017