#1   Report Post  
Posted to microsoft.public.excel.newusers
Mike Rogers
 
Posts: n/a
Default User form

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Dave Peterson
 
Posts: n/a
Default User form

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Mike Rogers
 
Posts: n/a
Default User form

Dave,

Yes an input box! I am trying to input information into a range of cells
that I can have locked. Thereby disallowing anyone from copy and pasting the
information in one cell to another. Would the input box be called by
selecting a cell in the desired range? Or would it be called by a command
button?

"Dave Peterson" wrote:

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.newusers
Dave Peterson
 
Posts: n/a
Default User form

Either way is ok with me.

If you want it based on selecting a cell, you could use a worksheet event:

Rightclick on the worksheet tab that should have the behavior. Select view
code. Paste this in:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

UserForm1.Show

End Sub

You'll have to adjust the range and the userform name.

Or something like this to use an inputbox:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If

End Sub




Mike Rogers wrote:

Dave,

Yes an input box! I am trying to input information into a range of cells
that I can have locked. Thereby disallowing anyone from copy and pasting the
information in one cell to another. Would the input box be called by
selecting a cell in the desired range? Or would it be called by a command
button?

"Dave Peterson" wrote:

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Mike Rogers
 
Posts: n/a
Default User form

Dave

Wow thanks for the complete response!!!! I really do appreiciate it. I
think the simplest solution is the imput box. But I have a problem with
either way..... I already have a Private Sub Worksheet_SelectionChange(ByVal
Target As Range) procedure in place and, as little as I know, I know two of
them will not work well together. What changes would I need to make in the
input box code to call it from a command button, if that will work at all???
and then place the data in the active cell.
Thanks again

Mike Rogers

"Dave Peterson" wrote:

Either way is ok with me.

If you want it based on selecting a cell, you could use a worksheet event:

Rightclick on the worksheet tab that should have the behavior. Select view
code. Paste this in:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

UserForm1.Show

End Sub

You'll have to adjust the range and the userform name.

Or something like this to use an inputbox:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If

End Sub




Mike Rogers wrote:

Dave,

Yes an input box! I am trying to input information into a range of cells
that I can have locked. Thereby disallowing anyone from copy and pasting the
information in one cell to another. Would the input box be called by
selecting a cell in the desired range? Or would it be called by a command
button?

"Dave Peterson" wrote:

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.newusers
Dave Peterson
 
Posts: n/a
Default User form

You'll have to combine them:

For instance:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Not (Intersect(Target, Me.Range("a2:a99")) Is Nothing) Then
myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If
End If

'your other code

End Sub





Mike Rogers wrote:

Dave

Wow thanks for the complete response!!!! I really do appreiciate it. I
think the simplest solution is the imput box. But I have a problem with
either way..... I already have a Private Sub Worksheet_SelectionChange(ByVal
Target As Range) procedure in place and, as little as I know, I know two of
them will not work well together. What changes would I need to make in the
input box code to call it from a command button, if that will work at all???
and then place the data in the active cell.
Thanks again

Mike Rogers

"Dave Peterson" wrote:

Either way is ok with me.

If you want it based on selecting a cell, you could use a worksheet event:

Rightclick on the worksheet tab that should have the behavior. Select view
code. Paste this in:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

UserForm1.Show

End Sub

You'll have to adjust the range and the userform name.

Or something like this to use an inputbox:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If

End Sub




Mike Rogers wrote:

Dave,

Yes an input box! I am trying to input information into a range of cells
that I can have locked. Thereby disallowing anyone from copy and pasting the
information in one cell to another. Would the input box be called by
selecting a cell in the desired range? Or would it be called by a command
button?

"Dave Peterson" wrote:

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.newusers
Mike Rogers
 
Posts: n/a
Default User form

Dave,

Thanks for all the help!!!! Everything works perfect. I had a couple
different Worksheet_SelectionChange codes in some of the worksheets and
figured out how to combine them to work!!!!! Did not know that could be
done!!! Thanks for the help and the education.

Mike Rogers

"Dave Peterson" wrote:

You'll have to combine them:

For instance:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Not (Intersect(Target, Me.Range("a2:a99")) Is Nothing) Then
myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If
End If

'your other code

End Sub





Mike Rogers wrote:

Dave

Wow thanks for the complete response!!!! I really do appreiciate it. I
think the simplest solution is the imput box. But I have a problem with
either way..... I already have a Private Sub Worksheet_SelectionChange(ByVal
Target As Range) procedure in place and, as little as I know, I know two of
them will not work well together. What changes would I need to make in the
input box code to call it from a command button, if that will work at all???
and then place the data in the active cell.
Thanks again

Mike Rogers

"Dave Peterson" wrote:

Either way is ok with me.

If you want it based on selecting a cell, you could use a worksheet event:

Rightclick on the worksheet tab that should have the behavior. Select view
code. Paste this in:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

UserForm1.Show

End Sub

You'll have to adjust the range and the userform name.

Or something like this to use an inputbox:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If

End Sub




Mike Rogers wrote:

Dave,

Yes an input box! I am trying to input information into a range of cells
that I can have locked. Thereby disallowing anyone from copy and pasting the
information in one cell to another. Would the input box be called by
selecting a cell in the desired range? Or would it be called by a command
button?

"Dave Peterson" wrote:

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.newusers
Dave Peterson
 
Posts: n/a
Default User form

It's nice when a plan comes together!

Glad you got it working.

Mike Rogers wrote:

Dave,

Thanks for all the help!!!! Everything works perfect. I had a couple
different Worksheet_SelectionChange codes in some of the worksheets and
figured out how to combine them to work!!!!! Did not know that could be
done!!! Thanks for the help and the education.

Mike Rogers

"Dave Peterson" wrote:

You'll have to combine them:

For instance:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Not (Intersect(Target, Me.Range("a2:a99")) Is Nothing) Then
myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If
End If

'your other code

End Sub





Mike Rogers wrote:

Dave

Wow thanks for the complete response!!!! I really do appreiciate it. I
think the simplest solution is the imput box. But I have a problem with
either way..... I already have a Private Sub Worksheet_SelectionChange(ByVal
Target As Range) procedure in place and, as little as I know, I know two of
them will not work well together. What changes would I need to make in the
input box code to call it from a command button, if that will work at all???
and then place the data in the active cell.
Thanks again

Mike Rogers

"Dave Peterson" wrote:

Either way is ok with me.

If you want it based on selecting a cell, you could use a worksheet event:

Rightclick on the worksheet tab that should have the behavior. Select view
code. Paste this in:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

UserForm1.Show

End Sub

You'll have to adjust the range and the userform name.

Or something like this to use an inputbox:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim myStr As String

If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a2:a99")) Is Nothing Then
Exit Sub
End If

myStr = InputBox(Prompt:="what do you want to enter in " _
& Target.Address(0, 0) & "?")

If Trim(myStr) = "" Then
'do nothing
Else
Me.Unprotect Password:="hi"
Application.EnableEvents = False
Target.Value = myStr
Application.EnableEvents = True
Me.Protect Password:="hi"
End If

End Sub




Mike Rogers wrote:

Dave,

Yes an input box! I am trying to input information into a range of cells
that I can have locked. Thereby disallowing anyone from copy and pasting the
information in one cell to another. Would the input box be called by
selecting a cell in the desired range? Or would it be called by a command
button?

"Dave Peterson" wrote:

You mean inputbox?

If you have lots of data to retrieve all at once, a userform seems better to me.

If it's just one per row, maybe inputbox would suffice.

Debra Dalgleish has some getstarted notes at:
http://contextures.com/xlUserForm01.html

Mike Rogers wrote:

Hi All:

Would it be better to use code with a msg box to enter data into a range of
cells or would a UserForm be better? Is it possible to use a UserForm to
place data in only a range of cells? If that can be done can it place the
data in the selected cell within that range?

Mike Rogers

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
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
Example User Form Required robertguy Excel Discussion (Misc queries) 0 October 4th 05 02:25 PM
Print scrollable user form. cparsons Excel Discussion (Misc queries) 2 August 4th 05 04:45 PM
user form static69 Excel Discussion (Misc queries) 1 February 6th 05 08:43 PM
Data Entry Alert in User Form Kev Excel Discussion (Misc queries) 6 January 8th 05 03:01 PM
A "previous" button on a user form Anthony Slater Excel Discussion (Misc queries) 3 November 29th 04 05:57 PM


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

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"