Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Test for multiple rows

Hi

How can I check the output from the following to ensure
that only one row has been selected

Dim rRange As Range

Set rRange = Application.InputBox(Prompt:="Please select any entry within
" _
& vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)

Thanks
Sandy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Test for multiple rows

Sandy,

After the inputbox line, use

If rRange.Rows.Count 1 Then
Set rRange = rRange.Rows(1)
MsgBox "I will work on only " & rRange.Address
End If

HTH,
Bernie
MS Excel MVP


"Sandy" wrote in message
...
Hi

How can I check the output from the following to ensure
that only one row has been selected

Dim rRange As Range

Set rRange = Application.InputBox(Prompt:="Please select any entry within " _
& vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)

Thanks
Sandy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Test for multiple rows

This uses the first row of whatever was selected...
'--
Sub Uncertain()
Dim rRange As Range

On Error Resume Next
Set rRange = Application.InputBox _
(Prompt:="Please select any entry within" & _
vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)
On Error GoTo 0

If rRange Is Nothing Then Exit Sub
Set rRange = rRange.EntireRow.Rows(1)
MsgBox "You selected row " & rRange.Row & " ", vbInformation, "Sandy"
End Sub
--
Jim Cone
Portland, Oregon USA




"Sandy"
wrote in message
Hi
How can I check the output from the following to ensure
that only one row has been selected

Dim rRange As Range
Set rRange = Application.InputBox(Prompt:="Please select any entry within " _
& vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)

Thanks
Sandy

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Test for multiple rows

Jim,

Be careful with that EntireRow since it will extend the range beyond the initial rRange (possibly).

HTH,
Bernie
MS Excel MVP


"Jim Cone" wrote in message
...
This uses the first row of whatever was selected...
'--
Sub Uncertain()
Dim rRange As Range

On Error Resume Next
Set rRange = Application.InputBox _
(Prompt:="Please select any entry within" & _
vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)
On Error GoTo 0

If rRange Is Nothing Then Exit Sub
Set rRange = rRange.EntireRow.Rows(1)
MsgBox "You selected row " & rRange.Row & " ", vbInformation, "Sandy"
End Sub
--
Jim Cone
Portland, Oregon USA




"Sandy"
wrote in message
Hi
How can I check the output from the following to ensure
that only one row has been selected

Dim rRange As Range
Set rRange = Application.InputBox(Prompt:="Please select any entry within " _
& vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)

Thanks
Sandy



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Test for multiple rows

Bernie, Jim
Thank you very much - exactly what I needed.
Sandy

"Sandy" wrote in message
...
Hi

How can I check the output from the following to ensure
that only one row has been selected

Dim rRange As Range

Set rRange = Application.InputBox(Prompt:="Please select any entry within
" _
& vbCrLf & "the row you would like to amend.", _
Title:="Select a row", Type:=8)

Thanks
Sandy




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Test for multiple rows


Hi Bernie,
That was my intent as Sandy said: "to ensure that only one row has been selected"
But maybe the intent was... only cells in one row have been selected?
There's a solution out there somewhere. <g
Sincerely,
Jim Cone
Portland, Oregon USA


"Bernie Deitrick"
wrote in message
Jim,
Be careful with that EntireRow since it will extend the range beyond the initial rRange (possibly).
HTH,
Bernie
MS Excel MVP

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Test for multiple rows

My phraseology Jim
The intent was to ensure "only cells in one row have been selected"
However I now know how to account for the whole row too :)
Sandy

"Jim Cone" wrote in message
...

Hi Bernie,
That was my intent as Sandy said: "to ensure that only one row has been
selected"
But maybe the intent was... only cells in one row have been selected?
There's a solution out there somewhere. <g
Sincerely,
Jim Cone
Portland, Oregon USA


"Bernie Deitrick"
wrote in message
Jim,
Be careful with that EntireRow since it will extend the range beyond the
initial rRange (possibly).
HTH,
Bernie
MS Excel MVP

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
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 PM
Crteating Multiple GIFS from Multiple Ranges -- need someone to test my code to see why it fails Father Guido[_5_] Excel Programming 4 November 22nd 05 05:28 AM
Creating Multiple GIFs from Multiple Range selections -- I need a volunteer to test my code to see why it fails Father Guido[_5_] Excel Programming 0 November 19th 05 08:52 AM
Crteating Multiple GIFS from Multiple Ranges -- need someone to test my code to see why it fails Father Guido[_5_] Excel Programming 0 November 19th 05 08:00 AM
Looping thru all rows with instr() test Silvertip Excel Programming 6 November 1st 05 02:29 PM


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