Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
I am trying to loop a macro in excel. The macro will merge, for example,
cells F3:H3. I want the macro to perform the merge for all rows that have data in column F. Does anybody know what code will make this work? Thanks in advance. |
#2
![]() |
|||
|
|||
![]()
Mergedcells can break lots of things. I only use them when I really, really
have to. But how about something like: Option Explicit Sub testme01() Dim myCell As Range Dim myRng As Range With ActiveSheet Set myRng = .Range("f1", .Cells(.Rows.Count, "F").End(xlUp)) End With For Each myCell In myRng.Cells If IsEmpty(myCell) Then 'do nothing Else Application.DisplayAlerts = False myCell.Resize(1, 3).Merge Application.DisplayAlerts = True End If Next myCell End Sub accessuser1308 wrote: I am trying to loop a macro in excel. The macro will merge, for example, cells F3:H3. I want the macro to perform the merge for all rows that have data in column F. Does anybody know what code will make this work? Thanks in advance. -- Dave Peterson |
#3
![]() |
|||
|
|||
![]()
This did exactly what I needed. Thank you very much
"accessuser1308" wrote: I am trying to loop a macro in excel. The macro will merge, for example, cells F3:H3. I want the macro to perform the merge for all rows that have data in column F. Does anybody know what code will make this work? Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error trapped only while stepping through the code - Not triggered when run | Excel Discussion (Misc queries) | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) | |||
Opening a file with code without a set file name | Excel Discussion (Misc queries) | |||
Error trapped only while stepping through the code - Not triggered when run | Excel Discussion (Misc queries) | |||
The available macros list in XL; how to suppress filename from showing | Excel Discussion (Misc queries) |