Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting new column between the columns


Hi Everybody,

I wnat to insert a new column between the columns E&F i
multiple sheets (say sheet1 to sheet10) with a specified width, if an
body have the code Pl. Tell me.

Thanks and Regards

Raman

--
ram11
-----------------------------------------------------------------------
ram117's Profile: http://www.excelforum.com/member.php...fo&userid=2782
View this thread: http://www.excelforum.com/showthread.php?threadid=49009

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Inserting new column between the columns

Ramana
Public Sub Insert_Col()
Dim Sht As Worksheet
For Each Sht In Worksheets
Sht.Range("F1").EntireColumn.Insert
Next
End Sub

Is this what you are after?
Ken Johnson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Inserting new column between the columns

Hi Ramana,
Sorry, I left out the bit about column width!
How about:

Public Sub Insert_Col()
Dim Sht As Worksheet
For Each Sht In Worksheets
With Sht.Range("F1")
..EntireColumn.Insert
..Offset(0, -1).ColumnWidth = 12
End With
Next
End Sub

This makes the column width = 12, change according to your needs.
Ken Johnson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Inserting new column between the columns

Hi yet again Ramana,

If you only want certain sheets to get the extra column between E&F
then this example adds the column to only the 2nd, 3rd, 4th and 5th
sheets, determined by the k values in the If statement:

Public Sub Insert_Col()
Dim Sht As Worksheet, k As Byte
For Each Sht In Worksheets
k = k + 1
If k = 2 And k <= 5 Then
With Sht.Range("F1")
..EntireColumn.Insert
..Offset(0, -1).ColumnWidth = 12
End With
End If
Next
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Inserting new column between the columns


Hi Ken,

thanks for the reply. While running the code it is giving me
runtime error at this line.

With sht.Range("f1").EntireColumn.Insert.Offset(0, -1).ColumnWidth =
12

It saying "object" required Pl. can you have a look into this.

Thanks and Regards

Ramana


--
ram117
------------------------------------------------------------------------
ram117's Profile: http://www.excelforum.com/member.php...o&userid=27826
View this thread: http://www.excelforum.com/showthread...hreadid=490098



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Inserting new column between the columns

Hi Ramana,
that is actually three separate lines of code:
With Sht.Range("F1")
..EntireColumn.Insert
..Offset(0,-1).ColumnWidth = 12
End With

Make sure you start a new line at .EntireColumn....... then another
new line at .Offset etc

I ran the code on my PC and it worked fine.

Let me know how you go.
Ken Johnson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Inserting new column between the columns

Hi Ramana,

Select all the sheets you want to insert the new column in (you can select
multiple sheets by clicking on the sheet tabs by holding the CTRL button),
insert the new column and adjust the width. Anything you do on the top sheet
(data entry, formatting, ....... will reflect in ALL those selected sheets).
Now click on any one of those sheet tabs to get out of the multiple selection
mode.

Regards,
B. R. Ramachandran

"ram117" wrote:


Hi Everybody,

I wnat to insert a new column between the columns E&F in
multiple sheets (say sheet1 to sheet10) with a specified width, if any
body have the code Pl. Tell me.

Thanks and Regards

Ramana


--
ram117
------------------------------------------------------------------------
ram117's Profile: http://www.excelforum.com/member.php...o&userid=27826
View this thread: http://www.excelforum.com/showthread...hreadid=490098


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Inserting new column between the columns

Hi Ken,

Thanks for looking into my problem now it is working fine.

Thanks and Regards

Ramana

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Inserting new column between the columns

Hi Ramana,
Glad to be of assistance.
Ken Johnson

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 to Inserting Columns and then add column to horizontal total Alex Excel Discussion (Misc queries) 0 February 17th 10 11:16 AM
Inserting columns GARY Excel Discussion (Misc queries) 2 August 13th 08 04:29 PM
Inserting new columns past the last column The Beverage Outlet- Cahoun GA Excel Discussion (Misc queries) 3 June 6th 08 04:56 PM
inserting new columns CJ Excel Discussion (Misc queries) 5 September 16th 06 07:18 PM
Inserting columns into a row park Excel Discussion (Misc queries) 1 August 2nd 05 10:09 PM


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