Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting Variable Row Range w/Macro

I currently need to change the following so that I can
select a variable amount of rows, rather than 1 column. I
am sure that it has to do with the str_column, but can not
figure out how! this is the script I am presently working
with:

Const target_wb = "VCS Merge Data WORKBOOK.xls"
Dim str_column
Dim file_name
Dim source_wb
Dim str_search As String
Dim str_replace As String

file_name = Application.GetOpenFilename
Workbooks.Open Filename:=CStr(file_name)
source_wb = ActiveWindow.Caption
str_column = InputBox("Enter your column to copy")
str_column = str_column & ":" & str_column
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Selecting Variable Row Range w/Macro

Hi Steve

You can use this in your code

Sub test()
Dim mycell As Range
Set mycell = Application.InputBox( _
prompt:="Select a range", Type:=8)

' mycell.Copy Sheets("Sheet2").Range("A1")

End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"steve" wrote in message ...
I currently need to change the following so that I can
select a variable amount of rows, rather than 1 column. I
am sure that it has to do with the str_column, but can not
figure out how! this is the script I am presently working
with:

Const target_wb = "VCS Merge Data WORKBOOK.xls"
Dim str_column
Dim file_name
Dim source_wb
Dim str_search As String
Dim str_replace As String

file_name = Application.GetOpenFilename
Workbooks.Open Filename:=CStr(file_name)
source_wb = ActiveWindow.Caption
str_column = InputBox("Enter your column to copy")
str_column = str_column & ":" & str_column



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Selecting Variable Row Range w/Macro

Steve,

Untested.

Const target_wb = "VCS Merge Data WORKBOOK.xls"
Dim str_column
Dim file_name
Dim source_wb
Dim str_search As String
Dim str_replace As String

file_name = Application.GetOpenFilename
Workbooks.Open Filename:=CStr(file_name)
source_wb = ActiveWindow.Caption
str_column = InputBox("Enter your column to copy")

Cells(1,str_column).Resize(Cells(Rows.Count,str_co lumn).End(xlUp).Row).Selec
t

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"steve" wrote in message
...
I currently need to change the following so that I can
select a variable amount of rows, rather than 1 column. I
am sure that it has to do with the str_column, but can not
figure out how! this is the script I am presently working
with:

Const target_wb = "VCS Merge Data WORKBOOK.xls"
Dim str_column
Dim file_name
Dim source_wb
Dim str_search As String
Dim str_replace As String

file_name = Application.GetOpenFilename
Workbooks.Open Filename:=CStr(file_name)
source_wb = ActiveWindow.Caption
str_column = InputBox("Enter your column to copy")
str_column = str_column & ":" & str_column



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Selecting Variable Row Range w/Macro

Take a look at the InputBox method of the Application
object using Type 8 in the help file. That might be
better for what you're trying to do.

-Brad
-----Original Message-----
I currently need to change the following so that I can
select a variable amount of rows, rather than 1 column.

I
am sure that it has to do with the str_column, but can

not
figure out how! this is the script I am presently

working
with:

Const target_wb = "VCS Merge Data WORKBOOK.xls"
Dim str_column
Dim file_name
Dim source_wb
Dim str_search As String
Dim str_replace As String

file_name = Application.GetOpenFilename
Workbooks.Open Filename:=CStr(file_name)
source_wb = ActiveWindow.Caption
str_column = InputBox("Enter your column to copy")
str_column = str_column & ":" & str_column
.

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
Selecting a variable print area in a macro Surrealest Excel Discussion (Misc queries) 2 June 7th 09 07:08 AM
Macro for Selecting Cells within a Range ToddS Excel Worksheet Functions 2 April 3rd 09 09:04 PM
Selecting a range of cells in a macro Victor Delta[_2_] Excel Discussion (Misc queries) 5 July 26th 08 12:19 AM
macro syntax for selecting variable range Matt Excel Discussion (Misc queries) 1 October 31st 07 07:13 PM
Selecting a Range Using a Variable Bob J. Excel Programming 4 September 14th 03 09:24 PM


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