Solved

need to DELETE cell b1 in 500 workbooks

Posted on 2015-02-18
13
45 Views
Last Modified: 2015-02-18
i have 500 workbooks in a folder

i need to preserve data in column a and in b2:b...basically just need to move column B up one value
each workbook has varying length of rows

prior related question: http:Q_28618738.html

thanks
0
Comment
Question by:finnstone
  • 5
  • 4
  • 2
  • +1
13 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40616593
First of all, you need to open each spreadsheet in turn.
 
Use the code shown in Reading document properties in multiple files to do that.
 
The only changes you have to make are the last two sections. So, instead of all of the code from mySheet.Cells(introw, 1) = strFile downwards, use
 
    Sheets("MYSHEET").Cells(1, 2).Delete Shift:=xlUp
    ActiveWorkbook.Close SaveChanges:=True
 
where MYSHEET is the sheet name.
 
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28619254.html
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40616613
your title says Delete B1 in 500 workbook

whereas your post says
in b2:b...basically just need to move column B up one value

that is not very clear this B2:B...

is it delete B1 in each workbook ?
Are they all in same folder or we have also subfolders and subfolders ... ?

gowlfow
0
 

Author Comment

by:finnstone
ID: 40616665
yes delete b1 in every book
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40616771
one more question your cell B1 is in every sheet of these workbooks ? or only the first sheet ? are these what csv or xls or .. ?
gowflow
0
 

Author Comment

by:finnstone
ID: 40616787
just the first sheet

they are csv
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40616824
Sheets(1).Cells(1, 2).Delete Shift:=xlUp
    ActiveWorkbook.Close SaveChanges:=True
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 45

Expert Comment

by:aikimark
ID: 40616826
@finnstone

Put Phillip's statement in the file iteration loop from the prior question(s).
0
 
LVL 29

Accepted Solution

by:
gowflow earned 500 total points
ID: 40616866
ok here it is.

Put this file anywhere but not in the folder you need to process. When you activate the button delete B1 from all files it will prompt you for a master folder select the folder it will process all csv files in that folder and all sub directories and delete B1 from these files.

As a precaution as we are deleting data I suggest you first simulate or take a copy of several files put them in a Temp directory and try it then look at the files to make sure it is what you want. Then you can go live with this.

This file will show you a trace of what it is doing.
Let me know
gowflow
DELB1-V01.xlsm
0
 

Author Comment

by:finnstone
ID: 40617148
i pushed the button and nothing happens...i even tried writing the path value into the cell

any ideas?
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40617171
enable macros
gowlfow
0
 

Author Closing Comment

by:finnstone
ID: 40617448
awesome!
0
 
LVL 29

Expert Comment

by:gowflow
ID: 40617465
Glad it worked.
gowflow
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now