Formatting Excel spreadsheets, part II

drjekyll325

New Member
Joined
Dec 30, 2003
Messages
24
Hi everyone,

I have an Excel spreadsheet that I am using Access 97 VBA to manipulate. I can't get the find-and-replace functionality to work, even though I have used the VBA code from an Excel macro, only modifying the object reference. Specifically, I am trying to replace all cells that = "0" in a range of columns to be blanked out.

Any suggestions?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,755
Office Version
  1. 365
Platform
  1. Windows
I have an Excel spreadsheet that I am using Access 97 VBA to manipulate

Why are using Access 97 VBA to manipulate it instead of using Excel VBA directly?

Anyway, another option, which may or may not work for you: Instead of replacing all the zeroes, can you simply change the format to display zeroes as blanks?
 

drjekyll325

New Member
Joined
Dec 30, 2003
Messages
24
Why are using Access 97 VBA to manipulate it instead of using Excel VBA directly?
Because the spreadsheet is generated by an Access application.

Anyway, another option, which may or may not work for you: Instead of replacing all the zeroes, can you simply change the format to display zeroes as blanks?
I couldn't find any format options to do this. Any suggestions?


Anyway, it's my belief the following code should work just fine:
objSchedule.Columns("G:AH").Replace("0", "", xlWhole, xlByRows, False)

What am I missing?
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
60,755
Office Version
  1. 365
Platform
  1. Windows
I have written a lot of Excel VBA code, and a lot of Access VBA code, but have not written code from one to another, so I am afraid I can't help you there.

However, instead of creating the Excel spreadsheet in Access, it is possible to create a pre-formatted Excel template that you can drop/export the Access data to? I am not sure how to do this, but just though tI would toss that idea out there...
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,565
Messages
5,765,140
Members
425,263
Latest member
alcat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top