Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Insert colum with 0's

Hi
During execution of a macro converting a *.xls to *.txt, i need to
insert a colum containing only zeros.
But it has to be the same length (number of rows), as the colum next
to it.

How to?

Best Regards
Henrik Bonde
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Insert colum with 0's

Bob:
I get Compile error - Sub or Function not defined, when trying this; Can
you review and comment on the possibilities??
Tks,
JMay

"Bob Phillips" wrote in message
...
Henrik,

This inserts the column after D

Sub InsertColumn()
Dim cRows As Long

cRows = Cells(Rows.Count, "D").End(xlUp).row
Columns("E:E").EntireColumn.Insert
Range("E1:E" & cRows).Value = "0"
End Sub


--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Henrik Bonde" wrote in message
...
Hi
During execution of a macro converting a *.xls to *.txt, i need to
insert a colum containing only zeros.
But it has to be the same length (number of rows), as the colum next
to it.

How to?

Best Regards
Henrik Bonde





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Insert colum with 0's

On Sat, 19 Jul 2003 23:48:13 +0100, "Bob Phillips"
wrote:

This inserts the column after D

Sub InsertColumn()
Dim cRows As Long

cRows = Cells(Rows.Count, "D").End(xlUp).row
Columns("E:E").EntireColumn.Insert
Range("E1:E" & cRows).Value = "0"
End Sub


That's the ticket
Thanks a lot :-)

Henrik


Mvh
Henrik Bonde

Ved svar via email, tryk ikke svar/reply,
adressen der virker ikke.
Men svar til HbondeSNABELAit.dk
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Insert colum with 0's

Struggling on that one. It's so simple it's difficult to see where that
error could arise. I don't get it, and as Tom says, it worked for him.

Any other details?

--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"JMay" wrote in message news:ScoSa.2767$If5.298@lakeread06...
Bob:
I get Compile error - Sub or Function not defined, when trying this; Can
you review and comment on the possibilities??
Tks,
JMay

"Bob Phillips" wrote in message
...
Henrik,

This inserts the column after D

Sub InsertColumn()
Dim cRows As Long

cRows = Cells(Rows.Count, "D").End(xlUp).row
Columns("E:E").EntireColumn.Insert
Range("E1:E" & cRows).Value = "0"
End Sub


--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Henrik Bonde" wrote in message
...
Hi
During execution of a macro converting a *.xls to *.txt, i need to
insert a colum containing only zeros.
But it has to be the same length (number of rows), as the colum next
to it.

How to?

Best Regards
Henrik Bonde







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 422
Default Insert colum with 0's

Heck if I know, maybe 3 or 4 spaces (" ") that got into the mix (I might
have screwed around with the code after pasting, but before running..
anyway I
sure do appreciate your help, Bob.
JMay
Virginia, USA

"Bob Phillips" wrote in message
...
Didn't we do well<g.

What's a blue block by the way?

Bob

"JMay" wrote in message

news:w2vSa.2777$If5.412@lakeread06...
OK, I played around with it, deleted out the space occupied by the Blue
Block, and PRESTO, I'm OK; << Another "learning experience"...Thanks

guys
for verifying there wasn't a problem with the code..


"JMay" wrote in message
news:mLuSa.2776$If5.2397@lakeread06...
Tom/Bob:
My Code: After running and getting the Compile Error Sub or Function

not
defined -- Where I've placed the **** below there is actually a full

3
or
4
space Blue Block, which might give a clue as to what's going on;

that's
all
I can offer.
Thanks for taking a look...

Sub InsertColumn()
Dim cRows As Long
cRows = Cells(Rows.Count, "D").End(xlUp).Row
**** Columns("E:E").EntireColumn.Insert
Range("E1:E" & cRows).Value = "0"
End Sub

"Tom Ogilvy" wrote in message
...
Pasted into a general module and it ran fine for me.

Regards,
Tom Ogilvy


JMay wrote in message

news:ScoSa.2767$If5.298@lakeread06...
Bob:
I get Compile error - Sub or Function not defined, when trying

this;
Can
you review and comment on the possibilities??
Tks,
JMay

"Bob Phillips" wrote in message
...
Henrik,

This inserts the column after D

Sub InsertColumn()
Dim cRows As Long

cRows = Cells(Rows.Count, "D").End(xlUp).row
Columns("E:E").EntireColumn.Insert
Range("E1:E" & cRows).Value = "0"
End Sub


--
HTH

-------

Bob Phillips
... looking out across Poole Harbour to the Purbecks


"Henrik Bonde" wrote in message
...
Hi
During execution of a macro converting a *.xls to *.txt, i

need
to
insert a colum containing only zeros.
But it has to be the same length (number of rows), as the

colum
next
to it.

How to?

Best Regards
Henrik Bonde














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 3 ROWS WHEN DATA OF COLUM CHANGED tran1728 Excel Discussion (Misc queries) 2 May 5th 10 08:06 AM
Look up a value in one colum and insert the value found in the adj lgr021238 New Users to Excel 1 December 17th 07 07:28 PM
Insert new colum, without changing information Penny Excel Worksheet Functions 1 April 19th 07 11:51 PM
Keeping a sum colum correct after inserting a colum of data in fro hazel Excel Discussion (Misc queries) 3 October 19th 05 09:51 PM
Check data on colum A and find match on colum b Chris(new user) Excel Discussion (Misc queries) 3 March 20th 05 04:45 PM


All times are GMT +1. The time now is 07:28 AM.

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

About Us

"It's about Microsoft Excel"