ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change Format of Entire Column (https://www.excelbanter.com/excel-programming/360108-change-format-entire-column.html)

Bill Barber

Change Format of Entire Column
 
I have imported our loan transfer file over the internet. For some reason
two columns "B" and "Y" come in all messed up.

The column should contain an Integer, however for some reason it can show as
anything, but mostly different Date Formats.

I noticed That when I clicked on the Column and changed the Column Format to
General, all of the transferred numbers displayed correctly.

The manager wants me to do it programmically and does not want anyone to do
it manually.

I know Visual Basic fairly well, but this is the first time (believe it or
not) that I have ever used Excel.

I purchased a couple of Excel books (Both Microsoft Press) but they do not
show how to change a column, just individual cells and/or rows.

I would appreciate if someone who knows can get me started with some script
as to how to do this.

Any help will be really appreciated.

Thanks a Lot

Bill

Ken Johnson

Change Format of Entire Column
 
Hi Bill,

Columns("B:B").NumberFormat = "General"
Columns("Y:Y").NumberFormat = "General"

is one way.

Ken Johnson


Bill Barber

Change Format of Entire Column
 
Ken;
Thanks for getting back to me!
I am getting a 13 Error Type Mismatch.

Here is the code I inserted!

Application.Goto Reference:="mcrFixColumnB"

Columns("B.B").NumberFormat = "General"

ChDir "C:\FirstNM"

Application.Run "march06wA.csv!mcrFixColumnB"

End Sub

Is this correct? If it is what do we try next?

"Ken Johnson" wrote:

Hi Bill,

Columns("B:B").NumberFormat = "General"
Columns("Y:Y").NumberFormat = "General"

is one way.

Ken Johnson



Bill Barber

Change Format of Entire Column
 
Ken;

I also tried

Thanks for getting back to me!
Same Error!

Getting a 13 Error Type Mismatch.

Here is the code I inserted!

Application.Goto Reference:="mcrFixColumnB"

Columns("B.B").NumberFormat = "0"

ChDir "C:\FirstNM"

Application.Run "march06wA.csv!mcrFixColumnB"

End Sub

Is this correct? If it is what do we try next?

"Bill Barber" wrote:

Ken;
Thanks for getting back to me!
I am getting a 13 Error Type Mismatch.

Here is the code I inserted!

Application.Goto Reference:="mcrFixColumnB"

Columns("B.B").NumberFormat = "General"

ChDir "C:\FirstNM"

Application.Run "march06wA.csv!mcrFixColumnB"

End Sub

Is this correct? If it is what do we try next?

"Ken Johnson" wrote:

Hi Bill,

Columns("B:B").NumberFormat = "General"
Columns("Y:Y").NumberFormat = "General"

is one way.

Ken Johnson



Tom Ogilvy

Change Format of Entire Column
 
Use a semicolon rather than a period:

Columns("B:B").NumberFormat = "General"

rather than

Columns("B.B").NumberFormat = "General"

--
Regards,
Tom Ogilvy


"Bill Barber" wrote in message
...
Ken;

I also tried

Thanks for getting back to me!
Same Error!

Getting a 13 Error Type Mismatch.

Here is the code I inserted!

Application.Goto Reference:="mcrFixColumnB"

Columns("B.B").NumberFormat = "0"

ChDir "C:\FirstNM"

Application.Run "march06wA.csv!mcrFixColumnB"

End Sub

Is this correct? If it is what do we try next?

"Bill Barber" wrote:

Ken;
Thanks for getting back to me!
I am getting a 13 Error Type Mismatch.

Here is the code I inserted!

Application.Goto Reference:="mcrFixColumnB"

Columns("B.B").NumberFormat = "General"

ChDir "C:\FirstNM"

Application.Run "march06wA.csv!mcrFixColumnB"

End Sub

Is this correct? If it is what do we try next?

"Ken Johnson" wrote:

Hi Bill,

Columns("B:B").NumberFormat = "General"
Columns("Y:Y").NumberFormat = "General"

is one way.

Ken Johnson





Ken Johnson

Change Format of Entire Column
 
Sorry Bill, I was away from the computer.
I trust Tom's fixed it up.

Ken Johnson



All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com