Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default lock first row and first column WITHOUT selecting Cell "B2" first?

Hi,

I'm new to this group.
From a VB6-Program I create a new workbook with 1 worksheet.
After writing the title row I want to set the first column and the first
row non-scrollable. This is my actual code in the VB6 program:
ws.Range("B2").Select
ActiveWindow.FreezePanes = True

I tested it, it works.

My Question: is there another way to do this WITHOUT selecting
the cell first? Doing it with an non-active window?

I've searched to no avail, but probably haven't asked the right questions
or used the correct terms. (English isn't my first language).

TIA,

Helmut.



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default lock first row and first column WITHOUT selecting Cell "B2" first?


Sub FP()
With ActiveWindow
.SplitColumn = 0
.SplitRow = 2
.FreezePanes = True
End With
End Sub



"Helmut Meukel" wrote in message
...
Hi,
I'm new to this group.
From a VB6-Program I create a new workbook with 1 worksheet.
After writing the title row I want to set the first column and the first
row non-scrollable. This is my actual code in the VB6 program:
ws.Range("B2").Select
ActiveWindow.FreezePanes = True

I tested it, it works.
My Question: is there another way to do this WITHOUT selecting
the cell first? Doing it with an non-active window?

I've searched to no avail, but probably haven't asked the right questions
or used the correct terms. (English isn't my first language).

TIA,

Helmut.





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default lock first row and first column WITHOUT selecting Cell "B2" first?

Short answer is No!

You can, indeed should, do almost everything in Excel without use of
activate or select. However there are just a few things with the Window
object you do need to, and what you are trying to do is one of them. If you
are using VB6 and automating a hidden instance, there's no need to make the
application itself visible. Try this in VBA

Sub test()
Dim xl As Excel.Application, wb As Excel.Workbook, wn As Excel.Window

Set xl = New Application
Set wb = xl.Workbooks.Add

wb.Worksheets(2).Activate
wb.Worksheets(2).Range("D4").Activate

xl.Windows(1).FreezePanes = True
xl.Visible = True

' might want to do xl.usercontrol = true

End Sub

There are also one or two settings that can only be set with at least one
visible workbook.

Regards,
Peter T

"Helmut Meukel" wrote in message
...
Hi,
I'm new to this group.
From a VB6-Program I create a new workbook with 1 worksheet.
After writing the title row I want to set the first column and the first
row non-scrollable. This is my actual code in the VB6 program:
ws.Range("B2").Select
ActiveWindow.FreezePanes = True

I tested it, it works.
My Question: is there another way to do this WITHOUT selecting
the cell first? Doing it with an non-active window?

I've searched to no avail, but probably haven't asked the right questions
or used the correct terms. (English isn't my first language).

TIA,

Helmut.





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default lock first row and first column WITHOUT selecting Cell "B2"first?

On Apr 26, 11:22*pm, "Helmut Meukel" wrote:
Hi,

I'm new to this group.
From a VB6-Program I create a new workbook with 1 worksheet.
After writing the title row I want to set the first column and the first
row non-scrollable. This is my actual code in the VB6 program:
* * ws.Range("B2").Select
* * ActiveWindow.FreezePanes = True

I tested it, it works.

My Question: is there another way to do this WITHOUT selecting
the cell first? Doing it with an non-active window?

I've searched to no avail, but probably haven't asked the right questions
or used the correct terms. (English isn't my first language).

TIA,

Helmut.


If you want to avoid select for speeding up the code you can use
following line

application.goto reference:=ws.Range("b2"),scroll:=true
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Excel Discussion (Misc queries) 1 November 15th 09 09:33 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Why does "Show Formulas" in Excel 2007 lock column alignment Collingwood Excel Worksheet Functions 1 May 21st 08 03:34 PM
How do I "lock" a column so I can scroll across to another colum andysarms New Users to Excel 1 February 10th 07 10:21 PM
How do I "lock" a graphic to a particular cell in Excel? Darlene Excel Worksheet Functions 2 March 28th 06 10:17 AM


All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"