Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
referring by index to adjacent cells
Hi,
I need to repeatedly select a cell by its index (e.g. Cells(r,1) with a loop over r), and merge it with the cell to the right. Could you please tell me how it can be done? (Can I select the cell, and then expand Selection to the right?) Thank you very much! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
referring by index to adjacent cells
Hi
one way: cells(r,1).resize(1,2).select -- Regards Frank Kabel Frankfurt, Germany Demyan wrote: Hi, I need to repeatedly select a cell by its index (e.g. Cells(r,1) with a loop over r), and merge it with the cell to the right. Could you please tell me how it can be done? (Can I select the cell, and then expand Selection to the right?) Thank you very much! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
referring by index to adjacent cells
I assumed you meant to iterate through a range of cells
using a loop and to merge each of these cells with the cell on the right. There is seldom a need to select cells. Sub MergeCells() Dim r As Integer For r = 5 To 10 Cells(r, 1).Resize(1, 2).MergeCells = True Next r End Sub Regards, Greg -----Original Message----- Hi, I need to repeatedly select a cell by its index (e.g. Cells(r,1) with a loop over r), and merge it with the cell to the right. Could you please tell me how it can be done? (Can I select the cell, and then expand Selection to the right?) Thank you very much! . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
referring by index to adjacent cells
Use the Range selection and cells to select the anchor and the range extent.
So...... Range(Cells(r, c1), Cells(r, c2)).Select where c1 = first column and c2 increments to extend range to the right. Cheers Nigel "Demyan" wrote in message ... Hi, I need to repeatedly select a cell by its index (e.g. Cells(r,1) with a loop over r), and merge it with the cell to the right. Could you please tell me how it can be done? (Can I select the cell, and then expand Selection to the right?) Thank you very much! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Add cells on two adjacent rows but non-adjacent columns | Excel Worksheet Functions | |||
IF Formula referring to 2 cells | Excel Discussion (Misc queries) | |||
Referring to Cells | Excel Discussion (Misc queries) | |||
Sort a list with cells referring to others cells | Excel Discussion (Misc queries) | |||
referring to other cells with formulas | Excel Worksheet Functions |