LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 5,934
Default assign a value to a cell

Oh... yeah.... I think you might be right; that may very well be what the OP
is asking for.

--
Rick (MVP - Excel)


"Don Guillett" wrote in message
...
COUNTA???

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"totally lost" wrote in message
...
Rick, that works (the one where you can delete the entry) excpet no
matter
what I type in the cell it changes it to 1, can we do the same thing
except
when I type something in the cell it will stay eg. I type 67451 and it
will
show 67451 but will still only be "counted" as 1.

"Rick Rothstein" wrote:

Yes, using VB code; however, it is unclear what you want to do if the
user
tries to delete the value. The following code assume the user cannot
delete
the value...

Right click the tab at the bottom of the worksheet, select View Code,
and
copy/paste the following code into the code window that appeared...

' ************* Start of Code *************
Private Sub Worksheet_Change(ByVal Target As Range)
Const RangeAddress As String = "B3:C5"
If Not Intersect(Target, Range(RangeAddress)) Is Nothing Then
Application.EnableEvents = False
Target.Value = 1
Application.EnableEvents = True
End If
End Sub
' ************* End of Code *************

Note: Change the range in the first statement (starts with Const) to the
actual range you want to apply this functionality to.

If you want to allow the user to be able to delete the entry, use this
code
instead...

' ************* Start of Code *************
Private Sub Worksheet_Change(ByVal Target As Range)
Const RangeAddress As String = "B3:C5"
If Not Intersect(Target, Range(RangeAddress)) Is Nothing Then
Application.EnableEvents = False
If Target.Value < "" Then Target.Value = 1
Application.EnableEvents = True
End If
End Sub
' ************* End of Code *************

--
Rick (MVP - Excel)


"totally lost" <totally
wrote in message
...
is it possible to assign a cell or range of cells to have a value of 1
no
matter what you type into that cell




 
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
Assign Cell to move to joaniemic Excel Discussion (Misc queries) 1 June 23rd 08 12:00 PM
How can I assign a data for one cell from another fixed cell? new Excel user New Users to Excel 3 November 9th 07 05:46 PM
How do i assign cell A1 to show the current cursor cell in Excel? OB Excel Discussion (Misc queries) 2 October 11th 06 04:02 PM
how do i assign a value to a cell containing text Ani63 Excel Worksheet Functions 5 September 14th 06 08:41 PM
Assign a color to a cell Junkyard Engineer Excel Worksheet Functions 1 June 6th 05 08:29 PM


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