-
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?
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
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
-
7 tips to get the most out of Windows 11
by
Alex5723
49 minutes ago -
Using Office apps with non-Microsoft cloud services
by
Peter Deegan
31 minutes ago -
I installed Windows 11 24H2
by
Will Fastie
15 minutes ago -
NotifyIcons — Put that System tray to work!
by
Deanna McElveen
1 hour, 31 minutes ago -
Decisions to be made before moving to Windows 11
by
Susan Bradley
1 hour, 32 minutes ago -
Port of Seattle says ransomware breach impacts 90,000 people
by
Nibbled To Death By Ducks
1 hour, 43 minutes ago -
Looking for personal finance software with budgeting capabilities
by
cellsee6
3 hours, 5 minutes ago -
ATT/Yahoo Secure Mail Key
by
Lil88reb
14 hours, 24 minutes ago -
Devices with apps using sprotect.sys driver might stop responding
by
Alex5723
18 hours, 46 minutes ago -
Neowin – 20 times computers embarrassed themselves with public BSODs and goofups
by
EP
1 day, 3 hours ago -
Slow Down in Windows 10 performance after March 2025 updates ??
by
arbrich
5 hours, 36 minutes ago -
Mail from certain domains not delivered to my outlook.com address
by
pumphouse
11 hours, 44 minutes ago -
Is data that is in OneDrive also taking up space on my computer?
by
WShollis1818
22 hours, 24 minutes ago -
Nvidia just fixed an AMD Linux bug
by
Alex5723
2 days, 14 hours ago -
50 years and counting
by
Susan Bradley
4 hours, 43 minutes ago -
Fix Bluetooth Device Failed to Delete in Windows Settings
by
Drcard:))
1 day, 20 hours ago -
Licensing and pricing updates for on-premises server products coming July 2025
by
Alex5723
3 days, 1 hour ago -
Edge : Deprecating window.external.getHostEnvironmentValue()
by
Alex5723
3 days, 1 hour ago -
Rethinking Extension Data Consent: Clarity, Consistency, and Control
by
Alex5723
3 days, 1 hour ago -
OneNote and MS Word 365
by
CWBillow
3 days, 3 hours ago -
Ultimate Mac Buyers Guide 2025: Which Mac is Right For You?
by
Alex5723
3 days, 3 hours ago -
Intel Unison support ends on Windows 11 in June
by
Alex5723
3 days, 3 hours ago -
April 2025 — still issues with AMD + 24H2
by
Kevin Jones
18 hours, 55 minutes ago -
Windows 11 Insider Preview build 26200.5518 released to DEV
by
joep517
3 days, 15 hours ago -
Windows 11 Insider Preview build 26120.3671 (24H2) released to BETA
by
joep517
3 days, 15 hours ago -
Forcing(or trying to) save Local Documents to OneDrive
by
PateWilliam
4 days ago -
Hotpatch for Windows client now available (Enterprise)
by
Alex5723
3 days, 12 hours ago -
MS-DEFCON 2: Seven months and counting
by
Susan Bradley
2 days, 13 hours ago -
My 3 monitors go black & then the Taskbar is moved to center monitor
by
saturn2233
4 days, 9 hours ago -
Apple backports fixes
by
Susan Bradley
3 days, 15 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.