Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Paul
 
Posts: n/a
Default How to determine which rows contain slected cells in a multiple c.

When I've selected a number of different cells in a column , I would like to
set a certain value in the corresponding neigbouring cells by pressing a
button.
So I have to access the slected row values somehow. So far it only works
when a continuous set of cells is selected, using the selection.rows.count
propertie.
Who can help me?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

I'm not quite sure what you're doing, but maybe you can loop through the
discontiguous areas:

Option Explicit
Sub testme()
Dim myRng As Range
Dim myArea As Range

Set myRng = Selection
For Each myArea In myRng.Areas
myArea.Offset(0, 1).Value = "Hi there"
Next myArea
End Sub



Paul wrote:

When I've selected a number of different cells in a column , I would like to
set a certain value in the corresponding neigbouring cells by pressing a
button.
So I have to access the slected row values somehow. So far it only works
when a continuous set of cells is selected, using the selection.rows.count
propertie.
Who can help me?


--

Dave Peterson
  #3   Report Post  
Paul Westerman
 
Posts: n/a
Default

Hi Dave,

Thanks very much for your help.
I missed your reply, but fortunately found it today.
It was essentially what I was looking for.
To be precize I wanted to do the following:

Sub testme()
Dim myRng As Range
Dim myArea As Range

Set myRng = Selection
For Each myArea In myRng.Areas
x = myArea.Row
y = myArea.Count
Range("N" & x & ":N" & x + y - 1).Value = "Hi there"
Next myArea

End Sub

Thanks again!

Paul Westerman

"Dave Peterson" wrote:

I'm not quite sure what you're doing, but maybe you can loop through the
discontiguous areas:

Option Explicit
Sub testme()
Dim myRng As Range
Dim myArea As Range

Set myRng = Selection
For Each myArea In myRng.Areas
myArea.Offset(0, 1).Value = "Hi there"
Next myArea
End Sub



Paul wrote:

When I've selected a number of different cells in a column , I would like to
set a certain value in the corresponding neigbouring cells by pressing a
button.
So I have to access the slected row values somehow. So far it only works
when a continuous set of cells is selected, using the selection.rows.count
propertie.
Who can help me?


--

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
Multiple rows of data on a single axis (charting) ramseysgirl Charts and Charting in Excel 8 December 29th 04 06:00 PM
Counting rows based on criteria in multiple cells Margaret Excel Discussion (Misc queries) 11 December 2nd 04 11:04 PM
Counting "rows", i.e. simultaneous criteria for multiple cells gkline Excel Worksheet Functions 2 November 19th 04 07:30 AM
Inserting Multiple Rows with Formulas ShineboxNJ Excel Worksheet Functions 2 November 18th 04 02:30 AM
Count rows based on multiple criteria Murph Excel Worksheet Functions 1 October 28th 04 07:13 AM


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