-
WSJoseluis
AskWoody LoungerGot it thanks.
-
WSJoseluis
AskWoody LoungerHans, one last question, I am trying to write a macro to include this formula and populate the column for all the rows that have data. How can I go about doing this. When I also put the macro for the formula, I get a red ink on the line of coding and it refers back to the “-“. Any help would be great.
Sub CleanUpSheet()
‘
‘ CleanUpSheet Macro‘
‘
Columns(“A:D”).Select
Selection.Delete shift:=xlToLeft
Columns(“B:B”).Select
Selection.ClearContents
Columns(“A:C”).Select
Columns(“A:C”).EntireColumn.AutoFit
Range(“B1”).Select
ActiveCell.FormulaR1C1 = “PCA”
Columns(“A:B”).Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = “”
.ErrorTitle = “”
.InputMessage = “”
.ErrorMessage = “”
.ShowInput = True
.ShowError = True
End With
Range(“B2”).Select
Selection.FormulaArray = “=1*MID(A1,MAX(ROW($1:$100)*(MID(A1,ROW($1:$100),1)=”_”))+1,255)”
Selection.AutoFill Destination:=Selection
Range(“A1”).Select
End Sub -
WSJoseluis
AskWoody LoungerThanks Hans.
-
WSJoseluis
AskWoody LoungerThank you hans.
-
WSJoseluis
AskWoody LoungerBelow is the macro to insert a row and assign names to columns.
Rows(“1:1”).Select
Selection.Insert Shift:=xlDown
Columns(“A:O”).Select
Columns(“A:O”).EntireColumn.AutoFit
ActiveWindow.SmallScroll Down:=-12
Range(“A1”).Select
ActiveCell.FormulaR1C1 = “Name”
Rows(“1:1”).Select
Selection.Font.Bold = True
Range(“B1”).Select
ActiveCell.FormulaR1C1 = “Month”
Range(“C1”).Select
ActiveCell.FormulaR1C1 = “Index”
Range(“D1”).Select
ActiveCell.FormulaR1C1 = “Car Type”
Range(“E1”).Select
ActiveCell.FormulaR1C1 = “model Type”
Range(“F1”).Select
ActiveCell.FormulaR1C1 = “Survey Activity”
Range(“G1”).Select
ActiveCell.FormulaR1C1 = “Day”
Range(“G1”).Select
Selection.AutoFill Destination:=Range(“G1:N1”), Type:=xlFillDefault
Range(“G1:N1”).Select
Range(“O1”).Select
ActiveCell.FormulaR1C1 = “Total”
Range(“O2”).Select
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
End Sub -
WSJoseluis
AskWoody LoungerThanks.
-
WSJoseluis
AskWoody LoungerHans,
Is there a way to add to the macro a command to put a desktop shortcut for the created map drive J?
-
WSJoseluis
AskWoody LoungerOk.
-
WSJoseluis
AskWoody LoungerHans,
Can you tell me via which program I can do this? I would like to do it in an excel file or word. By the way, you are correct about the //. -
WSJoseluis
AskWoody LoungerHans you are a genius. This is exactly what I need. Thanks.
-
WSJoseluis
AskWoody LoungerHello Hans. The first statement on number 2 is correct. The sheet that I need begins with a “block” on it.
-
WSJoseluis
AskWoody LoungerHans, each workbook (file) has three sheets in it. However, I am only trying to pull one sheet from these workbooks. I was wondering if there is an if statement which can pull a sheet as is processing the workbook. The if statement would say
If Sheet name in workbook is “block1” or “block 2” or “block 3” or “block 4” then copy the sheet to the “recap” workbook. Let me know if this helps, if not, I can always run the macro, but will have to select all files with block 1 then all files with block 2 and so forth. -
WSJoseluis
AskWoody LoungerThanks. I ended up calling Linksys and found out that when the apple laptop ask for a password you have to put a dollar sign and then a key associated with the WEP. Thanks for the links.
-
WSJoseluis
AskWoody LoungerI am sorry Hans. I made some modifications to the names of the files from “1st half” to “block”. Each file has a sheet name call “block” too. Below is the new code
Sub Processfiles()
‘ Variable Declaration
Dim vFile As Variant
Dim FilesToOpen
Dim iFileCount As Integer
Dim x As Integer
Dim wbk As Workbook
On Error GoTo ErrHandler
Application.ScreenUpdating = False‘ Get files to work with
With Application.FileDialog(msoFileDialogFilePicker)
.Filters.Add “Excel files”, “*.xls”.InitialFileName = _
“C:adminNew Code StructuresNew Timesheet*block*.xls”
.AllowMultiSelect = True
If .Show = True Then
‘ Act on each file
For Each vFile In .SelectedItems
‘ Open it
Set wbk = Workbooks.Open(Filename:=vFile)
‘ Transfer sheet
wbk.Sheets(“block 1”).Copy Before:=Workbooks(“recap.xls”).Sheets(1)—————————–>when I run this macro and the sheet name is not “block 1” I get an error. The files I will be selecting can either have block 1,2,3 or 4. This is where I am running into the error. I don’t know if it makes sense or not, but I need to be able to select multiple files and different sheets (block 1, 2, 3, or 4)?
‘ Close it
wbk.Close SaveChanges:=False
Next vFile
End If
iFileCount = .SelectedItems.Count
End With‘ Give a message saying you are done
If iFileCount = 1 Then
MsgBox “1 File was processed”
Else
MsgBox iFileCount & ” Files were processed”
End IfExitHandler:
Application.ScreenUpdating = True
Exit SubErrHandler:
MsgBox Err.Description
Resume ExitHandler
End Sub -
WSJoseluis
AskWoody LoungerHans,
the sheet to copy will either be block 1, block2, block 3, or block four depending on the file is processing. However, it will only be one. For example if it selects (“1-15″ 1st Half”). It should process sheet (“block 1”). Each selected file will have a sheet called block with it. For example, (“1-15 1st Half”) will only have block 1. File (“16-30″ 2nd half”) will have a sheet call (“block 2”) Does that help?
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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
-
Office gets current release
by
Susan Bradley
52 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
2 hours, 30 minutes ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
1 hour, 25 minutes ago -
Stop the OneDrive defaults
by
CWBillow
3 hours, 18 minutes ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
13 hours, 14 minutes ago -
X Suspends Encrypted DMs
by
Alex5723
15 hours, 26 minutes ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
15 hours, 44 minutes ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
16 hours, 21 minutes ago -
OpenAI model sabotages shutdown code
by
Cybertooth
16 hours, 58 minutes ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
5 hours, 8 minutes ago -
Enabling Secureboot
by
ITguy
12 hours, 8 minutes ago -
Windows hosting exposes additional bugs
by
Susan Bradley
1 day ago -
No more rounded corners??
by
CWBillow
20 hours, 41 minutes ago -
Android 15 and IPV6
by
Win7and10
10 hours, 26 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
1 day, 13 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 day, 15 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
1 day, 10 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
1 day, 23 hours ago -
May preview updates
by
Susan Bradley
1 day, 10 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
1 day, 2 hours ago -
Just got this pop-up page while browsing
by
Alex5723
1 day, 15 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
1 day, 12 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
14 hours, 41 minutes ago -
At last – installation of 24H2
by
Botswana12
2 days, 14 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
11 hours, 28 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
3 days, 2 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 1 hour ago -
Limited account permission error related to Windows Update
by
gtd12345
3 days, 16 hours ago -
Another test post
by
gtd12345
3 days, 16 hours ago -
Connect to someone else computer
by
wadeer
3 days, 10 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.