Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Basic Offset Function Usage


I'm a beginner so this will be a stupid question. How do I use the
offset function with a counter as my row number? What I'm trying to do
is paste data from sheet 1 into sheet 2 using offset with the row
number increased by 14 each time. For example:

Counter =14
ActiveCell.FormulaR1C1="Offset(Sheet1!R[13]C[-1],Counter,0)"
Counter=Counter +14

It doesn't work. I realize I should use the Cells Function, but I do
not know how to do it.

The data in sheet 1 is in rows that are 14 rows apart in column A. I
want to post the data in sheet 2 directly underneath each other in one
column.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default Basic Offset Function Usage

If you want to paste (as opposed to creating a referencing formula as you
attempt in your code), try this

iRow = 1
Counter = 14
Cells(Counter, "A").Copy Destination:=Worksheets("Sheet2").Cells(iRow,
"A")
iRow = iRow + 1
Counter = Counter + 14
Cells(Counter, "A").Copy Destination:=Worksheets("Sheet2").Cells(iRow,
"A")


etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Novice" wrote in message
...

I'm a beginner so this will be a stupid question. How do I use the
offset function with a counter as my row number? What I'm trying to do
is paste data from sheet 1 into sheet 2 using offset with the row
number increased by 14 each time. For example:

Counter =14
ActiveCell.FormulaR1C1="Offset(Sheet1!R[13]C[-1],Counter,0)"
Counter=Counter +14

It doesn't work. I realize I should use the Cells Function, but I do
not know how to do it.

The data in sheet 1 is in rows that are 14 rows apart in column A. I
want to post the data in sheet 2 directly underneath each other in one
column.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Basic Offset Function Usage

icol = 3 ' column C, change to the column where you want the values
Cells(1,icol).Formula = "=Sheet1!$A$1"
lastrow = worksheets("Sheet1").Cells(rows.count,1).End(xlup) .row
j = 2
for i = 15 to lastrow step 14
cells(j,icol).Formula= "=Offset(Sheet1!$A$1," & i-1 & ",1)"
Next

Assumes the first value is in A1 and the next value is in A15 where pattern
continues. Sheet2 is the active sheet when you run the macro.

--
Regards,
Tom Ogilvy


Novice wrote in message
...

I'm a beginner so this will be a stupid question. How do I use the
offset function with a counter as my row number? What I'm trying to do
is paste data from sheet 1 into sheet 2 using offset with the row
number increased by 14 each time. For example:

Counter =14
ActiveCell.FormulaR1C1="Offset(Sheet1!R[13]C[-1],Counter,0)"
Counter=Counter +14

It doesn't work. I realize I should use the Cells Function, but I do
not know how to do it.

The data in sheet 1 is in rows that are 14 rows apart in column A. I
want to post the data in sheet 2 directly underneath each other in one
column.


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



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
Is there a test for basic excell knowledge/usage???? BELASMILE Excel Discussion (Misc queries) 4 January 16th 10 05:42 AM
how format date with TEXT() function for international usage? AlexBY Excel Worksheet Functions 3 May 8th 09 06:38 PM
About the usage of the function Keith Hui Excel Worksheet Functions 1 March 31st 09 04:12 PM
Function usage and outcome clarification CharlieEcho561 Excel Worksheet Functions 14 December 8th 08 10:06 PM
How to apply OFFSET as the range in a basic 'Copy' process... cdavidson Excel Discussion (Misc queries) 4 November 8th 05 08:43 PM


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