Insert colum with 0's

  • Thread starter Thread starter Henrik Bonde
  • Start date Start date
H

Henrik Bonde

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
 
Bob:
I get Compile error - Sub or Function not defined, when trying this; Can
you review and comment on the possibilities??
Tks,
JMay
 
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
 
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?
 
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
 
Back
Top