Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 04-13-2020, 07:56 PM
beno_83au beno_83au is offline Adjust Two Columns Without Changing Combined Size Windows 10 Adjust Two Columns Without Changing Combined Size Office 2019
Novice
Adjust Two Columns Without Changing Combined Size
 
Join Date: Apr 2020
Posts: 5
beno_83au is on a distinguished road
Default

Thanks Bob and Avri, I wasn't aware of that as a debugging method, although I'm no longer getting error messages now.

Quote:
Originally Posted by macropod View Post
Did you try the code I posted?
And yes, I did try the code, and it works to set both columns when I enter a width for Column B. So I have been trying to re-write that into a loop to resize C when I drag to resize B (p.s. Sorry if I'm not picking up on what you're telling me). I wen't on a bit of an adventure last night with it, and now with a fresh head I think I made have done things a little better...... So here's what I've got and then where I'm stuck:

Code:
Sub CommandButton1_Click()
Dim totalWidth As Single, columnBWidth As Single, columnCAdjustedWidth As Single
totalWidth = Columns("b").ColumnWidth + Columns("c").ColumnWidth
Do While Selection.Columns.Count = 2
    columnBWidth = Columns("b").ColumnWidth
    columnCAdjustedWidth = totalWidth - columnBWidth
    Columns("c:c").ColumnWidth = columnCAdjustedWidth
    Application.Wait(Now + TimeValue("0:00:01"))
    MsgBox ("Column adjusted")
Loop
MsgBox ("Ended.")
End Sub
When I run this, Excel seems to freeze until the "Column adjusted" message box appears (~1 second). The problem I'm having now is that with Excel frozen, I can't drag to resize anything obviously, and removing the MsgBox command just means I've got to force close to try again. Is it possible to run the loop in the background while I'm working on the sheet? Or should I be using one of the events that I've since discovered instead (that I had even less success with last night)?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adjust Two Columns Without Changing Combined Size How to Adjust Every Header Section Size at Once? CrossReach Word 4 03-13-2016 10:49 AM
Adjust Two Columns Without Changing Combined Size How do I adjust the size of the printed slide Suppy PowerPoint 2 01-27-2015 02:15 AM
How to adjust Image size and other question arjfca Word VBA 1 12-05-2014 02:00 AM
Adjust Two Columns Without Changing Combined Size Powerpoint 2013 doesn't adjust size on external display mejnik PowerPoint 1 04-04-2014 09:12 AM
Adjust Two Columns Without Changing Combined Size Adjust Window size at open Gary Drumm Windows 2 03-31-2014 08:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft