Jmoz092
Board Regular
- Joined
- Sep 8, 2017
- Messages
- 184
- Office Version
- 365
- 2011
- Platform
- Windows
- MacOS
I'm having trouble with a code. I want to insert data into some cells on certain worksheets in my workbook. I can do this for one sheet, but it is not doing it for every sheet that I intend it to. Also, I don't know how to VBA a border around each cell and auto adjust the width of the column to fit the newly inserted text. Any help would be appreciated.
Code:
Sub AddCheckData()
Dim ws As Worksheet
Dim check(2) As String
check(0) = "Yes"
check(1) = "No"
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
If ws.Name Like "**-**-** Invoice" Then
Range("F25").Value = ("Check Received?")
Range("G25").Value = ("Check #")
Range("H25").Value = ("Date Received")
End If
With Range("F26").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:=Join(check, ",")
End With
Next ws
Application.ScreenUpdating = True
End Sub