I have tried to write code to autofit only those cols containing ####
However, these cols are not being autofitted
It would be appreciated if you someone could kindly amend my code
Please Login or Register to view this content.
I have tried to write code to autofit only those cols containing ####
However, these cols are not being autofitted
It would be appreciated if you someone could kindly amend my code
Please Login or Register to view this content.
Maybe.
Please Login or Register to view this content.
Click the * Add Reputation button in the lower left hand corner of this post to say thanks.
Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.
Thanks for your help, but only need those columns that contain the ###### to autofit
Just using Text property rather than Value as the value can't be '#####' !
To combine with Like operator
Hi all!
Howard - the #### is not the cell value, it's just Excel's visual cue that numeric data contained in the cell is too wide to be displayed.
However, I see that the two columns of interest in the sample both include the word "Date" in the header. Could you use that to ID them?
Please Login or Register to view this content.
Last edited by leelnich; 07-06-2023 at 08:34 AM.
Clicking the Add Reputation star below helpful posts is a great way to show your appreciation.
Please mark your threads as SOLVED upon conclusion (Thread Tools above Post # 1). - Lee
According to VBA help a header is useless
PHP Code:
Sub Demo0()
Dim Rc As Range
For Each Rc In Sheet1.UsedRange.Rows(2).Cells
If Rc.Text Like "[#]*[#]" Then Rc.EntireColumn.AutoFit
Next
End Sub
And the smarter to check columns :
PHP Code:
Sub Demo1()
Dim Rc As Range
For Each Rc In Sheet1.UsedRange.Columns
If Not Rc.Find("#*#", , xlValues, 1) Is Nothing Then Rc.AutoFit
Next
End Sub
► Do you like it ? ► ► So thanks to click on bottom left star icon « ★ Add Reputation » ! ◄ ◄
Last edited by Marc L; 07-06-2023 at 08:35 AM.
Thanks for the code Marc
It works perfectly
Thanks for the help Leelnich
The First Date is the date of the transaction and the second date is the date it was processed
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks