Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Stating an area in vba

I would like to set an area in spreadsheet e.g. from A1 to maximum
value within the same column.
How to express in vba the following operation? Please help me, I
didn.t find it in my vba manual.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Stating an area in vba

Try thid:-

Sub sonic()
Set Myrange = Range(Range("A1"), Range("A65536").End(xlUp))
Myrange.Select
End Sub

Mike

"piotr-unia" wrote:

I would like to set an area in spreadsheet e.g. from A1 to maximum
value within the same column.
How to express in vba the following operation? Please help me, I
didn.t find it in my vba manual.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Stating an area in vba

Sorry, sorry, sorry

Should be "from A1 to maximum value within the same column and then I
want to extend marked area to some columns on the right"

Thanks in advance
Piotr

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Stating an area in vba

hi,

How do you decide how many columns to add? This resizes by 7 columns.
Sub sonic()
Set myrange = Range(Range("A1"), Range("A65536").End(xlUp))
myrange.Select
Selection.Resize(Selection.Rows.Count + 0, Selection.Columns.Count +
7).Select
End Sub

"piotr-unia" wrote:

Sorry, sorry, sorry

Should be "from A1 to maximum value within the same column and then I
want to extend marked area to some columns on the right"

Thanks in advance
Piotr


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Stating an area in vba

This will find the first occurrence of MAX in column A and resize the area
by 4 more columns. Change the +4 as needed:

Sub test()
Dim MyRng As Range
Dim MyMax As Double
Dim LRow As Long

LRow = Cells(Rows.Count, 1).End(xlUp).Row
Set MyRng = Range("A1:A" & LRow)
MyMax = Application.WorksheetFunction.Max(MyRng)
LRow = Cells.Find(MyMax).Row
Set MyRng = Range("A1:A" & LRow)
Set MyRng = MyRng.Resize(MyRng.Rows.Count, MyRng.Columns.Count + 4)
MyRng.Select ,select is optional
End Sub

Mike F
"piotr-unia" wrote in message
oups.com...
I would like to set an area in spreadsheet e.g. from A1 to maximum
value within the same column.
How to express in vba the following operation? Please help me, I
didn.t find it in my vba manual.



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
Can we find the stating date of the week in Excel or ms access? KK Excel Discussion (Misc queries) 1 July 31st 08 08:51 AM
WEEKNUM calculations for week stating with Tuesday P C Verma Excel Worksheet Functions 7 June 12th 08 07:07 AM
Comparing & Stating The Nearest Matching FARAZ QURESHI Excel Discussion (Misc queries) 2 April 11th 08 07:01 AM
My IF statement is stating False but if I manual calculate it it Kyla2000 Excel Discussion (Misc queries) 4 April 11th 06 04:22 AM
Stating ranges in formulae Steven Revell Excel Programming 3 November 10th 03 03:05 PM


All times are GMT +1. The time now is 06:06 PM.

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

About Us

"It's about Microsoft Excel"