A simple macro:
1.Run macro: Add a column after A (I have data at column B)
-->Now column A:same, Column B: new blank, column C:previous column B
2.Run macro again: Add a column after B
...
3.Run macro again: Add a column after C
...
A simple macro:
1.Run macro: Add a column after A (I have data at column B)
-->Now column A:same, Column B: new blank, column C:previous column B
2.Run macro again: Add a column after B
...
3.Run macro again: Add a column after C
...
Last edited by mariosmk555; 05-04-2014 at 06:31 AM.
Hi, mariosmk555,
maybe like this:
or![]()
Please Login or Register to view this content.
Ciao,![]()
Please Login or Register to view this content.
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
Hi, mariosmk555,
no need for a full quote here according to Forum Rule#12.
Only if Data exceeds Column C it would be of use here:
Starting at a certain range will not insert new columns prior to any filled cells, thatīs a different requirement.![]()
Please Login or Register to view this content.
Ciao,
Holger
Thanks for the fast response,
maybe I didn't explain well my goal.
I want to set a column: for example D (D and E are filled with data)
I want to run macro: and create 2 columns after D and shift E two times right.
When I run again the macro I want the new columns to be created after the previous two columns that macro created.
etc..
**Today is my first day with VBA and excel macro!
Hi, mariosmk555,
you should be more precise in what you are asking. In the opening post it was one column (the last one) which should be shifted. Now itīs two columns, and Iīm not so sure about the columns you have used or the range where to insert:
![]()
Please Login or Register to view this content.
Ciao,![]()
Please Login or Register to view this content.
Holger
You may try this code also.....
The code will ask you to input the column of interest, so you need to input the column alphabet. Suppose you want to insert two column after the col. D, in that case you need to input either d or D in the input box.
![]()
Please Login or Register to view this content.
Regards
sktneer
Treat people the way you want to be treated. Talk to people the way you want to be talked to.
Respect is earned NOT given.
Hello again you are very helpful.
I understand the code you wrote above.
But I think that it can be done simpler but I do not have the time to implement the idea. So let me tell what I am thinking.
Instead of using the first column as reference which means that we have to store the relative position after closing excel,
is it possible to give a name on column "E"="SteadyColumn"? Because what I want is to always create two new columns before the "SteadyColumn"
Doing that if we use as reference the named cell, it is simpler isn't it?
Good idea but instead of giving the option to the user to choose the column,
(I repeat what I said above), if we give a name to the column from which the new columns will always be created before it will be easier. Can we do that in macro?
paint.jpg
Last edited by mariosmk555; 05-04-2014 at 08:55 AM.
Hi, mariosmk555,
mark the cell with the cursor, goto the NameWindow (where you see the Cell Address), put "SteadyColumn" (without quotes and blanks) and press Enter.
Stop quoting full posts, please! And if your Excel can convert pictures into Workbooks go ahead with posting pictures (my versions of Excel canīt do that).![]()
Please Login or Register to view this content.
Ciao,
Holger
Perfect!
If you could also answer this question since you solved the problem, you will be extremely helpful.
How I can copy information from another cell to the newly created columns but by refering to them not by their actual names but as the column which is 1 time left to steady column and 2 times left to steady column?
This is only what I need: Range("SteadyColumn"-1) ..
You are a pro mate!!
Last edited by mariosmk555; 05-04-2014 at 09:18 AM.
Hi, mariosmk555,
you should really make up your mind about what you want prior to asking questions and not alter the requirements on each post.
Ciao,![]()
Please Login or Register to view this content.
Holger
Sorry but I don't really know how it works since is my first in the forum.
Can you please elaborate on the code that you just wrote?
I want to paste the copied information from cells A1 and B1 on the two new columns. How do I do that using your code?![]()
Please Login or Register to view this content.
Thanks again, and this is my last question on this post following your guidance.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks