Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default macro that selects mulitple columns

Hello you all,

I need a macro te select a couple of columns. The selection always
consists of column D to J. Now I want the macro to add a specific
column to this selection. The column is chosen by the user. It would
be nice if the user is promted a question which column should be added
to the selection, based on the values that are in row 2.

Example
In row 2 of columns K,L and M are the values:

K L M
Toyota Renault Ford

If the user selects Renault, column L has to be added to the
selection.

Would someone be so kind to create this?

Thanks in advance.

Bernd

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default macro that selects mulitple columns

Maybe...

Option Explicit
Sub testme()
Dim myRng As Range
Dim myCell As Range

Set myCell = Nothing
On Error Resume Next
Set myCell = Application.InputBox(Prompt:="Please click a cell", _
Type:=8).Cells(1)
On Error GoTo 0

If myCell Is Nothing Then
'user hit cancel, what should happen
Else
With ActiveSheet
Set myRng = Union(.Range("D:J"), _
.Range(myCell.Address).EntireColumn)
End With
myRng.Select
End If

End Sub


wrote:

Hello you all,

I need a macro te select a couple of columns. The selection always
consists of column D to J. Now I want the macro to add a specific
column to this selection. The column is chosen by the user. It would
be nice if the user is promted a question which column should be added
to the selection, based on the values that are in row 2.

Example
In row 2 of columns K,L and M are the values:

K L M
Toyota Renault Ford

If the user selects Renault, column L has to be added to the
selection.

Would someone be so kind to create this?

Thanks in advance.

Bernd


--

Dave Peterson
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
macro that selects mulitple columns [email protected] Excel Discussion (Misc queries) 0 June 14th 07 05:32 PM
How to write macro that selects relative locations NewKid Excel Worksheet Functions 2 September 12th 06 07:41 PM
Start Macro after user selects a choice from a pick list mathew Excel Discussion (Misc queries) 2 August 17th 06 03:28 PM
I need to return mulitple results in several columns please help Jerry Excel Discussion (Misc queries) 0 March 13th 06 10:46 PM
Repeating a formula across mulitple columns aebjeffrey Excel Worksheet Functions 1 March 5th 06 08:44 PM


All times are GMT +1. The time now is 06:49 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"