Sir Babydum GBE
08-16-2005, 07:02 AM
Hi
I have a macro that merges some cells. Currently, the number of cells to merge to the right of, and including the selected cell, is hard-wired into the code like this:
ActiveCell.Range("A1:f1").Select
With Selection
.MergeCells = True
End With
I select a cell, then click a button which executes the macro and the selected cell, as well as well as the five cells to the right are all merged into one.
What I want to do though is to get the macro to read B3 on sheet 2, that will contain a number. I want the macro to calculate the double of that number and merge that number of cells.
E.g. On sheet 1 I select cell H5. I run the macro which looks at B3 on sheet 2. It says ?3.5?. So on sheet 1, cells H5:N5 (7 cells) are merged.
Can anyone help with this please? :dunno
The Guru
I have a macro that merges some cells. Currently, the number of cells to merge to the right of, and including the selected cell, is hard-wired into the code like this:
ActiveCell.Range("A1:f1").Select
With Selection
.MergeCells = True
End With
I select a cell, then click a button which executes the macro and the selected cell, as well as well as the five cells to the right are all merged into one.
What I want to do though is to get the macro to read B3 on sheet 2, that will contain a number. I want the macro to calculate the double of that number and merge that number of cells.
E.g. On sheet 1 I select cell H5. I run the macro which looks at B3 on sheet 2. It says ?3.5?. So on sheet 1, cells H5:N5 (7 cells) are merged.
Can anyone help with this please? :dunno
The Guru