Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


Hello,

Does anyone know how to have a macro in Excell insert a new colum
automatically?

Also, if i was comparing dates in two columns, how could i have i
automatically enter the difference in the column newly created?

Thanks,

Chri

--
Altec10
-----------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...fo&userid=3453
View this thread: http://www.excelforum.com/showthread.php?threadid=54300

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


Yes, you can insert a column automatically and have it enter th
difference b/t two dates. What events will trigger the macro to inser
a column and enter the difference?
Altec101 Wrote:
Hello,

Does anyone know how to have a macro in Excell insert a new colum
automatically?

Also, if i was comparing dates in two columns, how could i have i
automatically enter the difference in the column newly created?

Thanks,

Chri


--
Ikaabo
-----------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...fo&userid=3337
View this thread: http://www.excelforum.com/showthread.php?threadid=54300

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


I would like to have it insert the column and data when the macro is run
manually.


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=543007

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


Here's an example of how you might go about it, tho obviously your
ranges will likely differ:
Sub MyMacro()
Range("C:C").EntireColumn.Insert
With Range("C1")
..Value = "=(B1-A1)"
..NumberFormat = "General"
End With
End Sub

Then you can create a macro button to Call MyMacro when pressed.
Altec101 Wrote:
I would like to have it insert the column and data when the macro is run
manually.



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=543007

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


Thanks for the reply.

If i had 2 columns of data with multiple rows (say 50 rows - the amount
of rows will be different each time) and wanted to get a date difference
between column C and D and have it automatically input the difference
into column E, is there a way I can do that ?


--
Altec101
------------------------------------------------------------------------
Altec101's Profile: http://www.excelforum.com/member.php...o&userid=34539
View this thread: http://www.excelforum.com/showthread...hreadid=543007



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


Give this a go
Sub MyMacro()
Dim i As Integer
i = 0
Range("E:E").EntireColumn.Insert
Range("E1").Select
Do
If IsEmpty(ActiveCell.Offset(i, -1)) = False Then
ActiveCell.Offset(i, 0).Value = "=(D1-C1)"
i = i + 1
End If
Loop Until IsEmpty(ActiveCell.Offset(i, -1))
Range("E:E").NumberFormat = "General"
End Sub
Altec101 Wrote:
Thanks for the reply.

If i had 2 columns of data with multiple rows (say 50 rows - the amount
of rows will be different each time) and wanted to get a date difference
between column C and D and have it automatically input the difference
into column E, is there a way I can do that ?



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=543007

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default insert column macro


Let's try this then...
Sub MyMacro()
Dim i As Integer
i = 0
Range("E:E").EntireColumn.Insert
Range("E1").Select
Do
If IsEmpty(ActiveCell.Offset(i, -1)) = False Then
ActiveCell.Offset(i, 0).FormulaR1C1 = "=(rc[-1]-rC[-2])"
i = i + 1
End If
Loop Until IsEmpty(ActiveCell.Offset(i, -1))
Range("E:E").NumberFormat = "General"
End Sub
Altec101 Wrote:
Thanks for the reply.

If i had 2 columns of data with multiple rows (say 50 rows - the amount
of rows will be different each time) and wanted to get a date difference
between column C and D and have it automatically input the difference
into column E, is there a way I can do that ?



--
Ikaabod
------------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...o&userid=33371
View this thread: http://www.excelforum.com/showthread...hreadid=543007

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
Insert Column with macro Garrystone Excel Discussion (Misc queries) 2 January 29th 08 09:33 AM
Macro- Column Insert lostatlewisu Excel Discussion (Misc queries) 4 August 17th 07 01:44 PM
Macro - Insert&Label Column, if the labeled column doesn't exist Jeff[_43_] Excel Programming 1 December 15th 04 09:33 PM
Need Macro to Find Column Heading -- if none, then insert new column Jeff[_43_] Excel Programming 0 December 15th 04 07:08 AM
Macro to insert column Colin Foster[_2_] Excel Programming 4 May 25th 04 04:49 PM


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