Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Delete from control button

Thanks DAD, forgot to revert that. It was A change in one of my many
attempts at trying to understand what the Op WANTED.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Die_Another_Day" wrote in message
oups.com...
Change Clear to ClearContents

Charles

jk wrote:
Thanks Bob,
The code leaves row 1 intact from A thru G but it wipes out the data
validations lists that exist from row 2 to 100 columns A thru G. The

first
code that DAD provided left those lists intact but wiped out the

headings.Is
there a way to somehow freeze or exclude the row one headings from any
deletion?

"Bob Phillips" wrote:

Forget the protection, and try this

Private Sub CommandButton1_Click()
With Me.UsedRange
.Offset(1, 0).Clear
End With
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jk" wrote in message
...
Thanks for the understanding of my lack of knowledge in coding.The

only
code
that i see on sheet 1 is :

Private Sub CommandButton1_Click()
Sheets("Sheet1").Cells.ClearContents
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub
This is from worksheet, selection change option. All i would like is

the
clearing of the sheet with the exception of row # 1 , columns "A"

thru "G"
which contain the column headings.Does above help in any way?


"Bob Phillips" wrote:

But you said you got an error when protecting/unprotecting, not in

the
bit
DAD gave you. Without seeing all your macro code I can't begin to

help.
Why
the reticence?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jk" wrote in message
...
This was the code given to me by DAD in the first message of

this
thread.
It
may be small but since code and modules is absoutely new to me,

it
works
to a
degree.I just need to clear out the sheet from the control

button
while
maintaining row "A" which has the column headings.

"Bob Phillips" wrote:

Come on, the whole code.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing

direct)

"jk" wrote in message
...
Sheets("Sheet1").Cells.ClearContents

The code works well in that it clears the entire sheet and

it
leaves
my
drop
down data validation lists intact so the sheet can be reused

again
and
again.The actual problem is i want to protect the column

labels
like
you
instructed but after protecting the sheet, it basically

disables
the
control
button as well.

"Bob Phillips" wrote:

Could you post the code that gives you the problem?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing
direct)

"jk" wrote in message
...
Thanks Bob. I have a small problem in that if i protect

the
sheet
so
the
column labels wont be deleted as well, I am unable to

run the
code. I
have
tried protecting and unprotecting that one cell with the
control
but
it
give
me a run time error.Can this control buttom use

additional
code to
prevent
that or placed somewhere else?

"Bob Phillips" wrote:

You should unlock all the data input cells, leaving

the
labels
and
formulae
locked, protect the worksheet, and then just add code

like
DAD
gave
you
to
the button.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if

mailing
direct)

"jk" wrote in message

...
Hi,
I want a reusable sheet without the user to manually

clear
out
all
the
entries and delete the data validation lists. How

would i
incorporate
the
code into a button that i can place on the sheet?


"Die_Another_Day" wrote:

I'm not sure exactly what you're after but try

this:
Sheets("Sheet1").Cells.ClearContents

Charles Chickering

jk wrote:
I have a sheet which contains a several data
validation
dependant
lists which
will be used amoung several people from distant
locations.They
will
fill in
all the fields and submit the sheet to other
departments.
I
would
like
to
create a control such as a button which would

delete
all
data
after
information has been submitted so a blank sheet

can be
used
several
times
without affecting the validation lists.Is this
possible?




















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
How to stop a Control Button moving when I delete columns(Excel) CH-DE-FDS APRIL Excel Discussion (Misc queries) 2 October 28th 08 10:08 AM
How can I delete a macro when the Delete button is not active? FCR Excel Worksheet Functions 0 March 9th 06 09:43 AM
Can't delete or edit control button Steve Excel Discussion (Misc queries) 1 July 15th 05 08:39 PM
Delete a custom button by holding down the ALT key and dragging the button off the toolbar Stephen[_8_] Excel Programming 0 April 4th 04 02:22 PM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM


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