Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have recorded a macro to select a range of cells, merge
them, and wrap the text. The problem I have is the macro returns to the row on which the macro was recorded. How do I have the macro select say columns B through F relative to the row I am on, then perform the rest of the macro. Thanks in advance! Kevin |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You should always post your code so we know you are trying.
"Kevin" wrote in message ... I have recorded a macro to select a range of cells, merge them, and wrap the text. The problem I have is the macro returns to the row on which the macro was recorded. How do I have the macro select say columns B through F relative to the row I am on, then perform the rest of the macro. Thanks in advance! Kevin |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Range("B42:J42").Select
With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With I understand everything except how to select a range of columns relative to the row the cursor is on. Kevin -----Original Message----- You should always post your code so we know you are trying. "Kevin" wrote in message ... I have recorded a macro to select a range of cells, merge them, and wrap the text. The problem I have is the macro returns to the row on which the macro was recorded. How do I have the macro select say columns B through F relative to the row I am on, then perform the rest of the macro. Thanks in advance! Kevin . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No selection required.
with range(cells(activecell.row,"b"),cells(activecell.r ow,"f")) .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True end with "Kevin" wrote in message ... Range("B42:J42").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With I understand everything except how to select a range of columns relative to the row the cursor is on. Kevin -----Original Message----- You should always post your code so we know you are trying. "Kevin" wrote in message ... I have recorded a macro to select a range of cells, merge them, and wrap the text. The problem I have is the macro returns to the row on which the macro was recorded. How do I have the macro select say columns B through F relative to the row I am on, then perform the rest of the macro. Thanks in advance! Kevin . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Kevin,
Dim myRow As Long myRow = ActiveCell.Row Range(Range("B" & myRow), Range("F" & myRow)).Select HTH, Bernie "Kevin" wrote in message ... I have recorded a macro to select a range of cells, merge them, and wrap the text. The problem I have is the macro returns to the row on which the macro was recorded. How do I have the macro select say columns B through F relative to the row I am on, then perform the rest of the macro. Thanks in advance! Kevin |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bernie,
Works great! Thanks! Kevin -----Original Message----- Kevin, Dim myRow As Long myRow = ActiveCell.Row Range(Range("B" & myRow), Range("F" & myRow)).Select HTH, Bernie "Kevin" wrote in message ... I have recorded a macro to select a range of cells, merge them, and wrap the text. The problem I have is the macro returns to the row on which the macro was recorded. How do I have the macro select say columns B through F relative to the row I am on, then perform the rest of the macro. Thanks in advance! Kevin . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA selecting an input range of cells | Excel Discussion (Misc queries) | |||
Macro for Selecting Cells within a Range | Excel Worksheet Functions | |||
Selecting a range of cells, how to ? | Excel Worksheet Functions | |||
Range selecting cells | Excel Discussion (Misc queries) | |||
how to combine cells by selecting range? | New Users to Excel |