Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
INSERT 3 ROWS WHEN DATA OF COLUM CHANGED | Excel Discussion (Misc queries) | |||
Look up a value in one colum and insert the value found in the adj | New Users to Excel | |||
Insert new colum, without changing information | Excel Worksheet Functions | |||
Keeping a sum colum correct after inserting a colum of data in fro | Excel Discussion (Misc queries) | |||
Check data on colum A and find match on colum b | Excel Discussion (Misc queries) |