![]() |
Positioning a sheet
I have a spreadsheet to which I add a column of data every day.
I have set my columns on the spreadsheet so that all of them are about 1.5 inches in width. This creates 8 columns that show on my screen at any one time. I would like a macro that will always position the sheet from left to right so that the last column on the right is a blank column and the other 7 columns to the left of the blank column will have prior data in them showing as well. Any suggestions would be much appreciated. Roger |
Positioning a sheet
Roger,
Looking at the ActiveWindow's VisibleRange and ScrollColumn properties would be a good place to start. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware "Roger Bedford" wrote in message I have a spreadsheet to which I add a column of data every day. I have set my columns on the spreadsheet so that all of them are about 1.5 inches in width. This creates 8 columns that show on my screen at any one time. I would like a macro that will always position the sheet from left to right so that the last column on the right is a blank column and the other 7 columns to the left of the blank column will have prior data in them showing as well. Any suggestions would be much appreciated. Roger |
Positioning a sheet
When open workbook,
the last column with data is cells(1, columns.count).end(xltoleft).column then application.goto cells(1, lastcolumn-7) true is what you want please. "Roger Bedford" wrote in message ... I have a spreadsheet to which I add a column of data every day. I have set my columns on the spreadsheet so that all of them are about 1.5 inches in width. This creates 8 columns that show on my screen at any one time. I would like a macro that will always position the sheet from left to right so that the last column on the right is a blank column and the other 7 columns to the left of the blank column will have prior data in them showing as well. Any suggestions would be much appreciated. Roger |
Positioning a sheet
Thanks Jim and PY for your suggestions.
Unfortunately Jim I am not familiar with ActiveWindow's VisibleRange and ScrollColumn properties and PY you can see below how far I got. 'Selects sheet and positions cursor Sheets("Data").Select Range("AP11").Select Selection.End(xlToLeft).Select 'the above macros work 'I tried this but it didn't work 'ActiveCell.Offset(0, -6).Range("A1").Select 'Goes left 6 'I couldn't get the following to work 'Cells(1, Columns.Count).End(xlToLeft).Column 'application.goto cells(1, lastcolumn-7)true If either of you could add another suggestion I would really appreciate it. Thanks, Roger "PY & Associates" wrote in message ... When open workbook, the last column with data is cells(1, columns.count).end(xltoleft).column then application.goto cells(1, lastcolumn-7) true is what you want please. "Roger Bedford" wrote in message ... I have a spreadsheet to which I add a column of data every day. I have set my columns on the spreadsheet so that all of them are about 1.5 inches in width. This creates 8 columns that show on my screen at any one time. I would like a macro that will always position the sheet from left to right so that the last column on the right is a blank column and the other 7 columns to the left of the blank column will have prior data in them showing as well. Any suggestions would be much appreciated. Roger |
Positioning a sheet
Roger, You can run into problems with the following code if you don't have the initial 8 columns in row 11 filled with data. Also, try typing "ScrollColumn" in your module and with the cursor still inside the word, press the F1 key. (however,i used PY's idea)... '--------------------- Sub MoveEmOut() Dim rngCell As Excel.Range Set rngCell = Sheets("Data").Cells(11, Columns.Count).End(xlToLeft).Offset(0, -6) Application.Goto rngCell, True Set rngCell = Nothing End Sub ---------- Jim Cone San Francisco, USA http://www.officeletter.com/blink/specialsort.html "Roger Bedford" wrote in message Thanks Jim and PY for your suggestions. Unfortunately Jim I am not familiar with ActiveWindow's VisibleRange and ScrollColumn properties and PY you can see below how far I got. 'Selects sheet and positions cursor Sheets("Data").Select Range("AP11").Select Selection.End(xlToLeft).Select 'the above macros work 'I tried this but it didn't work 'ActiveCell.Offset(0, -6).Range("A1").Select 'Goes left 6 'I couldn't get the following to work 'Cells(1, Columns.Count).End(xlToLeft).Column 'application.goto cells(1, lastcolumn-7)true If either of you could add another suggestion I would really appreciate it. Thanks, Roger |
All times are GMT +1. The time now is 11:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com