-
WSgvanhook
AskWoody LoungerPerfect!
Thanks -
WSgvanhook
AskWoody LoungerThis works great. Thank you!
Is there any way to make this adaptable for the ending column? The last column is not always E, but could be different for the rows. The sample I sent had most of the coulmns trimmed out to remove sensitive data.
tia,
Greg -
WSgvanhook
AskWoody LoungerThanks Rory! That was a great help
Greg
-
WSgvanhook
AskWoody LoungerHans,
Sorry for the months long delay, but this project got pushed back.
I have the following code established:Code:Sub Merit_Sheet_Setup() ' ' Merit_Sheet_Setup Macro ' this macro formats the merit sheets to be pushed out to the program areas. Dim wbk As Workbook Dim wsh As Worksheet Set wbk = ActiveWorkbook For Each wsh In wbk.Worksheets ' format individual sheets wsh.Cells.Select wsh.Cells.EntireColumn.AutoFit wsh.Range("A5").Select Selection.EntireColumn.Insert wsh.Columns("A:A").Select Selection.ColumnWidth = 1 wsh.Columns("B:F").Select Selection.EntireColumn.Hidden = True wsh.Columns("J:L").Select Selection.EntireColumn.Hidden = True wsh.Range("G2").Select ActiveWindow.FreezePanes = True ' lock the sheets leaving the Score & Delete columns editable and copy each sheet to a new workbook wsh.Columns("O:P").Select Selection.Locked = False Selection.FormulaHidden = False wsh.Range("G2").Select wsh.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="password" wsh.EnableSelection = xlUnlockedCells wsh.Copy ActiveWorkbook.Close SaveChanges:=True, Filename:=wsh.Name & ".xlsx" Next wsh End Sub
But I am finding that it is not walking through the sheets in the workbook. It goes through the first sheet just fine but after saving the first sheet, it is not moving to the second sheet. Any ideas?
Thanks is advance,
Greg -
WSgvanhook
AskWoody LoungerPerfect Hans!
Thank You
Greg -
WSgvanhook
AskWoody LoungerHans,
I am trying to adapt this custom function to a project I am working on. I need to determine the last column used within columns X:AZ for each row of a spreadsheet and then return the value of row 1 for that column into a cell. It seems as if this function is looking at the entire worksheet even if I enter a range in the formula. Any suggestions? Would another formula work better?I have attached a sample workbook. The column I am looking to populate is W.
Thanks!
Greg -
WSgvanhook
AskWoody LoungerIs there a way to modify this code to copy EACH sheet in a workbook to a separate file, then save the file using the sheet name as the filename?
Thanks! -
WSgvanhook
AskWoody LoungerJohn,
I tried using your suggested code, and while I do get a text file for each of my sheets, the txt files are being saved as sheet1.txt & sheet2.txt rather than the name of the sheet. This is an important part of the process. I also noticed that the name of one of the sheets remained as I named it, and the other became sheet2 and the name of the workbook became sheet2.txt.I have attached my test version of the file that has 2 sheets in it to see if you have any luck figuring out why.
Thanks! -
WSgvanhook
AskWoody LoungerHans,
I tried copying the sheets over to a new workbook and it worked. Thanks anyway. -
WSgvanhook
AskWoody LoungerWith my trials, that code only cleared about 100 rows of the original 3800 I had in the table. I cut the number of rows for my post to the lounge. The error I get is on the line:
m = wshSource.Range(“A” & Row.Count).End(xlUp).RowGreg
-
WSgvanhook
AskWoody LoungerPerfect as usual Hans! I was making it too complicated. Thanks for pointing me to this simpler solution.
-
WSgvanhook
AskWoody LoungerSure thing. I have deleted a lot of data from other coulmns, leaveing the ones that are salient to this need.
-
WSgvanhook
AskWoody LoungerHans,
Thank you. As always you have a quick an elegant solution. I have applied this and have run into one small glitch. There is the possibility that column ‘J’ may have no numeric entries, only text entries. When I ran it on a report that had no numeric entries I received a runtime 1004 error: No cells were found.Is there a modification I can make to the code that will allow for this situation?
-
WSgvanhook
AskWoody LoungerThank you Michael!
That did exactly what I wanted it to do. When you have the code for recording changes I would also be interested in that.
The workbooks I am using this in contain budget information that is provided by my office to managers of the individual budgets. It helps us in scheduling budget meetings to know when and if they have reviewed the reports or have made entries that we ned to act on.
-
WSgvanhook
AskWoody LoungerIf I wanted to save it immediately after opening, how would I do that? What might be undesirable about this?
I tried this code but it started the BeforeSave code which then failed because the protection is password protected.
Private Sub Workbook_Open()
With Worksheets(“View”)
.Unprotect (“xxxxxxx”)
.EnableOutlining = True
FormatUsageLog
EnterOpenData
.Protect UserInterfaceOnly:=True, Password:=(“xxxxxxx”)
End With
ActiveWorkbook.SaveEnd Sub
Thanks in advance,
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Network Issue
by
Casey H
1 hour, 37 minutes ago -
Fedora Linux is now an official WSL distro
by
Alex5723
4 hours, 48 minutes ago -
May 2025 Office non-Security updates
by
PKCano
5 hours, 14 minutes ago -
Windows 10 filehistory including onedrive folder
by
Steve Bondy
7 hours, 9 minutes ago -
pages print on restart (Win 11 23H2)
by
cyraxote
6 hours, 25 minutes ago -
Windows 11 Insider Preview build 26200.5581 released to DEV
by
joep517
9 hours, 21 minutes ago -
Windows 11 Insider Preview build 26120.3950 (24H2) released to BETA
by
joep517
9 hours, 22 minutes ago -
Proton to drop prices after ruling against “Apple tax”
by
Cybertooth
16 hours, 44 minutes ago -
24H2 Installer – don’t see Option for non destructive install
by
JP
1 hour, 6 minutes ago -
Asking Again here (New User and Fast change only backups)
by
thymej
1 day, 4 hours ago -
How much I spent on the Mac mini
by
Will Fastie
3 hours, 30 minutes ago -
How to get rid of Copilot in Microsoft 365
by
Lance Whitney
5 hours, 16 minutes ago -
Spring cleanup — 2025
by
Deanna McElveen
1 day, 9 hours ago -
Setting up Windows 11
by
Susan Bradley
5 hours ago -
VLC Introduces Cutting-Edge AI Subtitling and Translation Capabilities
by
Alex5723
1 day, 5 hours ago -
Powershell version?
by
CWBillow
1 day, 6 hours ago -
SendTom Toys
by
CWBillow
2 hours, 51 minutes ago -
Add shortcut to taskbar?
by
CWBillow
1 day, 10 hours ago -
Sycophancy in GPT-4o: What happened
by
Alex5723
2 days, 2 hours ago -
How can I install Skype on Windows 7?
by
Help
2 days, 1 hour ago -
Logitech MK850 Keyboard issues
by
Rush2112
1 day, 8 hours ago -
We live in a simulation
by
Alex5723
2 days, 16 hours ago -
Netplwiz not working
by
RetiredGeek
2 days, 3 hours ago -
Windows 11 24H2 is broadly available
by
Alex5723
3 days, 5 hours ago -
Microsoft is killing Authenticator
by
Alex5723
7 hours ago -
Downloads folder location
by
CWBillow
3 days, 11 hours ago -
Remove a User from Login screen
by
CWBillow
2 days, 7 hours ago -
TikTok fined €530 million for sending European user data to China
by
Nibbled To Death By Ducks
3 days, 2 hours ago -
Microsoft Speech Recognition Service Error Code 1002
by
stanhutchings
3 days, 2 hours ago -
Is it a bug or is it expected?
by
Susan Bradley
1 day, 4 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.