LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default range referencing


This code selects the current region, then highlighting only those cells
in column a that are blanks copying the cell above it.

The problem I'm having is that the input file changes, however I dont
know how to tell the macro the ActiveCell.Range changes. It always
seems to do the A1:A271 range instead of the current file that the
macro is working on which could be longer than the one used to record
the macro.

How do you instruct Excel to use the range relative to the worksheet?

TIA - lakey

Selection.CurrentRegion.Select
Range(Selection, Selection.End(xlDown)).Select
ActiveCell.Range("A1:A271").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.FormulaR1C1 = "=+R[-1]C"
Selection.End(xlDown).Select
ActiveCell.Offset(-2, 0).Range("A1:A3").Select
ActiveCell.Activate
Selection.ClearContents
ActiveCell.Columns("A:A").EntireColumn.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select


--
lakey13
------------------------------------------------------------------------
lakey13's Profile: http://www.excelforum.com/member.php...o&userid=15997
View this thread: http://www.excelforum.com/showthread...hreadid=275660

 
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
Referencing A Non Consecutive Range? RayportingMonkey Excel Discussion (Misc queries) 3 September 3rd 07 06:06 PM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
Referencing a Range of Sheets [email protected] Excel Discussion (Misc queries) 3 February 12th 07 09:47 AM
Indirect Range Referencing jeaton Charts and Charting in Excel 0 February 10th 06 02:25 PM
Referencing a range from another workbook Tom Ogilvy Excel Programming 0 August 6th 03 03:36 PM


All times are GMT +1. The time now is 03:16 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"