Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro to understand how wide or long the data range is

Hello, our golf club has a golf competition with difficult rules. Every
member can play once a week a result and you have approximately 16 weeks time
to improve your score (the sum of your 4 best results). Caddiemasters publish
every second week data of participants´ results and to know situation
(rankings) I have to rearrange data. And it´s boring to repeat some
activities in excel. I can write macros, but now I have to learn a little bit
more.

The data range is every time varying with its width and lenght. The width
varies based on the fact that week amount is raising. The lenght varies based
on amount of players is changing. Macro has to understand, how long the data
range is (calculate row amount, I suppose or understand the number of the
lowest row). Then macro copies first A column with players names and first
week column B, transport the data range to a new data sheet, then copy again
first A column and second week column C and transport the data range to
continut the new data sheet´s pivotable database and so on till we have
played weeks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Macro to understand how wide or long the data range is

You need to use xlup,xltoleft,xltoright,xldown

These option stop at blank cells so you have to be careful how you use them.
to ignore the blank cell the following usually works

LastRow = Range("A" & Rows.count).end(xlup).Row

This instruction goes to the last row in column A (rows.count = 65536) and
then moves up until it finds the first cell with data

LastCol = cells(1,columns.count).end(xltoleft).column

This instruction goes to the last column in row 1 (columns.count = 256) and
the moves to the left until it finds the first cell with data.

"Pekka" wrote:

Hello, our golf club has a golf competition with difficult rules. Every
member can play once a week a result and you have approximately 16 weeks time
to improve your score (the sum of your 4 best results). Caddiemasters publish
every second week data of participants´ results and to know situation
(rankings) I have to rearrange data. And it´s boring to repeat some
activities in excel. I can write macros, but now I have to learn a little bit
more.

The data range is every time varying with its width and lenght. The width
varies based on the fact that week amount is raising. The lenght varies based
on amount of players is changing. Macro has to understand, how long the data
range is (calculate row amount, I suppose or understand the number of the
lowest row). Then macro copies first A column with players names and first
week column B, transport the data range to a new data sheet, then copy again
first A column and second week column C and transport the data range to
continut the new data sheet´s pivotable database and so on till we have
played weeks.

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
How to create a chart with wide range of numbers Roxana Charts and Charting in Excel 3 October 16th 08 04:57 PM
Wide data range chasida Charts and Charting in Excel 2 January 9th 07 02:00 AM
Make Excel 2000 print long narrow list "snake" on wide paper? steve from mw rms rrd Excel Discussion (Misc queries) 2 March 1st 06 07:25 PM
restructure long to wide alphapoint05 Excel Programming 1 September 9th 05 01:32 PM
How to break scale when numbers are wide range? Rachel Charts and Charting in Excel 3 July 13th 05 06:25 PM


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

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"