Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default programatically selecting columns

Hi,

I am writing a macro to import multiple text files into a spreadsheet. The
only part I haven't figured out is how to step sideways, i.e the first text
file should use A1 as its origin, the second file C1, the third E1 and so
on.

Range(A1).Select
Range(C1).Select
Range(E1).Select


/Scott


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default programatically selecting columns

I think you can do this using the offset property. Eg Range("A1").Offset(0,
2) will take you to Range("C1"). The first argument in the bracket is for
rows and the second columns, and you can use negatives to 'move backwards'.
I'm very new to VBA so apologies if I am missing your point.

"ScottM" wrote:

Hi,

I am writing a macro to import multiple text files into a spreadsheet. The
only part I haven't figured out is how to step sideways, i.e the first text
file should use A1 as its origin, the second file C1, the third E1 and so
on.

Range(A1).Select
Range(C1).Select
Range(E1).Select


/Scott



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default programatically selecting columns

Sounds interesting Andy. I will try it. Thanks.

Scott


"AndyRoo" wrote in message
...
I think you can do this using the offset property. Eg
Range("A1").Offset(0,
2) will take you to Range("C1"). The first argument in the bracket is for
rows and the second columns, and you can use negatives to 'move
backwards'.
I'm very new to VBA so apologies if I am missing your point.

"ScottM" wrote:

Hi,

I am writing a macro to import multiple text files into a spreadsheet.
The
only part I haven't figured out is how to step sideways, i.e the first
text
file should use A1 as its origin, the second file C1, the third E1 and so
on.

Range(A1).Select
Range(C1).Select
Range(E1).Select


/Scott





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default programatically selecting columns

Range("A1").Select
Selection.Offset(0,2).Select

etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ScottM" wrote in message
...
Hi,

I am writing a macro to import multiple text files into a spreadsheet. The
only part I haven't figured out is how to step sideways, i.e the first

text
file should use A1 as its origin, the second file C1, the third E1 and so
on.

Range(A1).Select
Range(C1).Select
Range(E1).Select


/Scott




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default programatically selecting columns

Thanks for the assistance. My statement

With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & sDir + "\" &
sFileName, Destination:=Range("A1").Offset(0, iPosition))

works fine.

Scott


"Bob Phillips" wrote in message
...
Range("A1").Select
Selection.Offset(0,2).Select

etc.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ScottM" wrote in message
...
Hi,

I am writing a macro to import multiple text files into a spreadsheet.
The
only part I haven't figured out is how to step sideways, i.e the first

text
file should use A1 as its origin, the second file C1, the third E1 and so
on.

Range(A1).Select
Range(C1).Select
Range(E1).Select


/Scott








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default programatically selecting columns

I import two columns of data and want to delete one of them using my macro.
What is the proper syntax?

Scott


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default programatically selecting columns

Columns("D:D").Delete

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ScottM" wrote in message
...
I import two columns of data and want to delete one of them using my

macro.
What is the proper syntax?

Scott




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default programatically selecting columns



--

HTH

RP
(remove nothere from the email address if mailing direct)


"ScottM" wrote in message
...
Hi,

I am writing a macro to import multiple text files into a spreadsheet. The
only part I haven't figured out is how to step sideways, i.e the first

text
file should use A1 as its origin, the second file C1, the third E1 and so
on.

Range(A1).Select
Range(C1).Select
Range(E1).Select


/Scott




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
programatically selecting columns to import text into ScottM Excel Discussion (Misc queries) 2 November 25th 05 05:41 PM
Selecting Columns Shatin[_2_] Excel Programming 4 September 7th 05 01:07 PM
VBA Range Issue : Cannot programatically select more than 42 columns Learner[_3_] Excel Programming 4 January 31st 05 09:55 PM
Selecting columns aspadda Excel Programming 1 December 9th 03 03:56 AM
Selecting Columns xnman Excel Programming 2 November 18th 03 01:52 PM


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

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

About Us

"It's about Microsoft Excel"