![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Feb 2002
Location: Sackville
Posts: 39
|
Thanks daleyman, that did the trick. I tried similar code with no sucess, but yours did the trick. I knew it had to be something simple, but I kept going around the proper solution. Thanks for the help!!!
|
|
|
|
|
|
#2 |
|
New Member
Join Date: Feb 2002
Location: Sackville
Posts: 39
|
I have a DAT file that I am bring into Excel to modify. The field seperators are commas. When I have the required changes done, I want to save as text file, but need to put the commas back in (for import requirements in the next software package). I thought I had seen a tip to insert a blank column between all existing columns, but can't find it using search, and am getting frustrated trying to recreate it. Can anyone point me in the right direction to find the tip or tell me how to set the macro up?
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Are there a set number of columns?
How about saving as a csv file? Comma Seperated Values Tom [ This Message was edited by: TsTom on 2002-04-14 08:35 ] |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Mar 2002
Location: London, UK
Posts: 167
|
recent topic over last 24 hours...
click here ! .. also, if you cannot adjust this code to do it for you, are you asking for just a macro to insert a blank column every other column?
__________________
<table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;">***DALEY** :P**</td></table> |
|
|
|
|
|
#5 |
|
New Member
Join Date: Feb 2002
Location: Sackville
Posts: 39
|
I tried the CSV format, but the program to import into will not accept it. The quotes for text fields are already brought over when I import the data into Excel. I have 16 columns, some of them blank, that require a comma to seperate. A macro to insert 15 columns is all that is required as I have the rest of the code set up already. Why is it that the simple things always seem to cause the most problems?
[ This Message was edited by: Bagsy Baker on 2002-04-14 09:32 ] |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: London, UK
Posts: 167
|
still don't really understand the question. If its just alternate columns needing to be inserted, how about:
Sub insert_column_every_other() For colx = 2 To 30 Step 2 Columns(colx).Insert Shift:=xlToRight Next End Sub sorry, is this what you mean?
__________________
<table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;">***DALEY** :P**</td></table> |
|
|
|
|
|
#7 | |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Quote:
If you are inserting columns and shifting to the right, it is much better to go from right to left, as the columns will not fall out of sync with your colx value. It will be very difficult to keep track of the columns/count this way. Sub insert_column_every_other() For colx = 30 To 2 Step -2 Columns(colx).Insert Shift:=xlToRight Next End Sub will be better suited for this, much like when you delete rows, you work from bottom to top. Bye, Jay |
|
|
|
|
|
|
#8 |
|
New Member
Join Date: Nov 2011
Posts: 4
|
Hello,
Do you know how i would rework this so it works across more columns? and potentially add in 3 columns instead of just one? thanks for the help chris |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|