Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sort one coloumn according to another coloumn on another worksheet | Excel Worksheet Functions | |||
Format individual coloumn cell with corresponding coloum cell resu | Excel Worksheet Functions | |||
Trying to find the fourth blank cell in a column | Excel Discussion (Misc queries) | |||
highlight row and coloumn of selected cell | Excel Discussion (Misc queries) | |||
How to delete values of a cell if it is found in another coloumn | Excel Worksheet Functions |