Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default move within ss by active cell position, NOT by cell names

Complete code to work on various sheets, each having exact same columns, but
varying number of rows.
All cells in Columns A thru I have data
J and K columns are empty, at this point

How to move from a given point (active cell), to another cell without
referencing actual cell row locations ( K?), or (J?)

' Go to column C, end, Insert TOTALS ' this one works
Range("C1").Select
Selection.End(xlDown).Select
ActiveCell.FormulaR1C1 = "TOTALS"

' Move right 7 Cells, to "J"
Range ("J?").Select
Range("J?").Formula = "=(+I201-G201)/G201-1

' Move RIGHT 8 Cells to "K"
Range("K?").Select
ActiveCell.FormulaR1C1 = "%"

' Select the bottom used cells and format
Range("C?:K?").Select
Selection.Font.Bold = True
Selection.Font.Size = 12
With Selection
.HorizontalAlignment = xlCenter
End With
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default move within ss by active cell position, NOT by cell names

This will select the cell 7 cells to the right of the upper left cell
in the currently selected range (the A1 reference refers to the upper
left cell in the currently selected range, not the acutal cell A1):
ActiveCell.Offset(0, 7).Range("A1").Select


BEEJAY wrote:
Complete code to work on various sheets, each having exact same columns, but
varying number of rows.
All cells in Columns A thru I have data
J and K columns are empty, at this point

How to move from a given point (active cell), to another cell without
referencing actual cell row locations ( K?), or (J?)

' Go to column C, end, Insert TOTALS ' this one works
Range("C1").Select
Selection.End(xlDown).Select
ActiveCell.FormulaR1C1 = "TOTALS"

' Move right 7 Cells, to "J"
Range ("J?").Select
Range("J?").Formula = "=(+I201-G201)/G201-1

' Move RIGHT 8 Cells to "K"
Range("K?").Select
ActiveCell.FormulaR1C1 = "%"

' Select the bottom used cells and format
Range("C?:K?").Select
Selection.Font.Bold = True
Selection.Font.Size = 12
With Selection
.HorizontalAlignment = xlCenter
End With
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default move within ss by active cell position, NOT by cell names

I now understand (some of) the offset stuff.
I am now stuck on getting the formula worked out.

' Go to column C, end, Insert TOTALS: THIS ONE WORKS
Range("C1").Select
Selection.End(xlDown).Offset(1, 0).Select
ActiveCell.FormulaR1C1 = "TOTALS"

' Move RIGHT 8 Cells to "K" THIS ONE WORKS
ActiveCell.Offset(0, 8).Range("A1").Select
ActiveCell.FormulaR1C1 = "%"

' Move LEFT 1 Cell to "J"
ActiveCell.Offset(0, -1).Range("A1").Select

THIS is where I am now stuck.
Range("A1").Formula = "=((Offset(0,-1)-Offset(0, -3))/Offset(0,-3)-1"
Should work as: Range("J?").Formula = "=(+I?-G?)/G?-1

"John Fuller" wrote:

This will select the cell 7 cells to the right of the upper left cell
in the currently selected range (the A1 reference refers to the upper
left cell in the currently selected range, not the acutal cell A1):
ActiveCell.Offset(0, 7).Range("A1").Select


BEEJAY wrote:
Complete code to work on various sheets, each having exact same columns, but
varying number of rows.
All cells in Columns A thru I have data
J and K columns are empty, at this point

How to move from a given point (active cell), to another cell without
referencing actual cell row locations ( K?), or (J?)

' Go to column C, end, Insert TOTALS ' this one works
Range("C1").Select
Selection.End(xlDown).Select
ActiveCell.FormulaR1C1 = "TOTALS"

' Move right 7 Cells, to "J"
Range ("J?").Select
Range("J?").Formula = "=(+I201-G201)/G201-1

' Move RIGHT 8 Cells to "K"
Range("K?").Select
ActiveCell.FormulaR1C1 = "%"

' Select the bottom used cells and format
Range("C?:K?").Select
Selection.Font.Bold = True
Selection.Font.Size = 12
With Selection
.HorizontalAlignment = xlCenter
End With
End Sub



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
Active cell position for macro MechEng Excel Worksheet Functions 3 September 24th 07 01:44 PM
In macros, an instruction that will return the position of the Active Cell aca[_4_] Excel Programming 2 January 20th 06 10:50 PM
Why does cursor move position in a cell I'm trying to edit? BrendaK Excel Discussion (Misc queries) 3 August 22nd 05 10:32 PM
Macro to move first name to last position in cell Annette[_4_] Excel Programming 2 September 16th 04 09:22 PM
Active Cell Position Using Go To Or Hyperlink Keith Chipman Excel Programming 1 November 19th 03 03:05 PM


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