Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
hke hke is offline
external usenet poster
 
Posts: 1
Default Selecting every fourth cell in a coloumn

Hi all. I would like som help on the following:

Like when using the ctrl key, I want to select several non-adjacent
cells. I want to select every fourth cell in a coloumn with about 1500
cells.

The code below helps me to move the selection down, but it does not
keep the previous selection. Any sugestions?

ActiveCell.Select
For i = 1 To 1500
ActiveCell.Offset(3).Select
i = i + 1
Next



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Selecting every fourth cell in a coloumn

You can adapt this to suit your needs.

Sub EveryFourth()
Dim i As Integer
Dim rngR As Range

For i = 1 To 1500
If Not rngR Is Nothing Then
Set rngR = Union(rngR, Cells(i * 4, 1))
Else
Set rngR = Cells(i * 4, 1)
End If
Next i

rngR.Select

End Sub

Tested using Excel 97SR2 on Windows 98SE,

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

Hi all. I would like som help on the following:

Like when using the ctrl key, I want to select several non-adjacent
cells. I want to select every fourth cell in a coloumn with about 1500
cells.

The code below helps me to move the selection down, but it does not
keep the previous selection. Any sugestions?

ActiveCell.Select
For i = 1 To 1500
ActiveCell.Offset(3).Select
i = i + 1
Next


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Selecting every fourth cell in a coloumn


"hke" wrote in message
...
Hi all. I would like som help on the following:

Like when using the ctrl key, I want to select several non-adjacent
cells. I want to select every fourth cell in a coloumn with about 1500
cells.

The code below helps me to move the selection down, but it does not
keep the previous selection. Any sugestions?

ActiveCell.Select
For i = 1 To 1500
ActiveCell.Offset(3).Select
i = i + 1
Next


Try this:

Dim MyRange as Range
Set MyRange=ActiveCell

For i = 1 to 500
ActiveCell.Offset(3).Select
Set MyRange = Union (MyRange, ActiveCell)
Next i

Geoff




------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



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
Sort one coloumn according to another coloumn on another worksheet Sunir M S[_2_] Excel Worksheet Functions 0 December 6th 09 09:59 AM
Format individual coloumn cell with corresponding coloum cell resu Ashok Thapar Excel Worksheet Functions 1 November 26th 08 04:58 AM
Trying to find the fourth blank cell in a column teepee[_3_] Excel Discussion (Misc queries) 7 April 28th 08 12:09 AM
highlight row and coloumn of selected cell Dinesh Excel Discussion (Misc queries) 6 October 3rd 06 01:17 AM
How to delete values of a cell if it is found in another coloumn karty Excel Worksheet Functions 3 October 22nd 05 04:29 PM


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