bestandsnamen uit verkenner in excel lijst ok behalve namen met enkel 0

littlepete

Well-known Member
Joined
Mar 26, 2015
Messages
507
Office Version
  1. 365
Platform
  1. Windows
hallo :)
puzzelaar als ik ben heb ik een vba'tje geschreven om alle bestanden uit mijn map met gepersonaliseerde nummerplaten te kopieren naar excel...
dat gaat zeer snel en het aantal klopt ook... hoera !
maar:
de nummerplaten die enkel nullen bevatten (bv. 000 00000 00 0 00000000 ...) worden in excel gezet als 0, nochtans is die kolom ingesteld als tekst...
is er een manier om dit op te lossen?
mooie dag nog !

VBA Code:
Sub list()
cells(1,1).select
Dim naam as string
naam = Dir("D:\onedrive\my stuff\mijn media\mijn afbeeldingen\verzameling nummerplaten\" & "*.*")
Do While Len(naam) > 0
ActiveCell.Formula = naam
ActiveCell.Offset(1, 0).Select 
naam = Dir()
Loop
End sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try changing this line:
ActiveCell.Formula = naam

to:
ActiveCell.Formula = "'" & naam

This will prefix the value of naam with '
 
Upvote 1

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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
Back
Top