Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Selecting a range of cells

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Selecting a range of cells

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Selecting a range of cells

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 176
Default Selecting a range of cells

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Selecting a range of cells

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



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Selecting a range of cells

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



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA selecting an input range of cells Colin Hayes Excel Discussion (Misc queries) 4 April 19th 10 02:17 AM
Macro for Selecting Cells within a Range ToddS Excel Worksheet Functions 2 April 3rd 09 09:04 PM
Selecting a range of cells, how to ? Luc Excel Worksheet Functions 2 February 23rd 07 07:17 PM
Range selecting cells Alec H Excel Discussion (Misc queries) 2 March 14th 06 01:36 PM
how to combine cells by selecting range? SPIRIT New Users to Excel 3 August 20th 05 10:40 AM


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"