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

I'm having a little trouble getting a value of a cell to work as a variable
in an offset. In the snippet of code below, I am taking the value in cell R8
and copying it to the first empty cell at the end of column S. Next what I
want to do is take the same value and copy it "X" cells below and then fill
the value between the two points. The value I want to basically go down (and
use in the second offset) is in cell "U8". I can't for whatever reason get
the second offset to work with a variable. Thank you for any help you can
provide!

James

Range("R8").Select
Selection.Copy
Cells(Rows.Count, "S").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("R8").Select
Selection.Copy
Cells(Rows.Count, "S").End(xlUp).Offset(U8, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Cells(Rows.Count, "S").End(xlUp).Offset(1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Offset with variable

Try

Cells(Rows.Count, "S").End(xlUp).Offset(Range("U8").Value, 0).Select


--

HTH

RP
(remove nothere from the email address if mailing direct)


"James" wrote in message
...
I'm having a little trouble getting a value of a cell to work as a

variable
in an offset. In the snippet of code below, I am taking the value in cell

R8
and copying it to the first empty cell at the end of column S. Next what

I
want to do is take the same value and copy it "X" cells below and then

fill
the value between the two points. The value I want to basically go down

(and
use in the second offset) is in cell "U8". I can't for whatever reason

get
the second offset to work with a variable. Thank you for any help you can
provide!

James

Range("R8").Select
Selection.Copy
Cells(Rows.Count, "S").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("R8").Select
Selection.Copy
Cells(Rows.Count, "S").End(xlUp).Offset(U8, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Cells(Rows.Count, "S").End(xlUp).Offset(1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 542
Default Offset with variable

Works great! Thanks!

"Bob Phillips" wrote:

Try

Cells(Rows.Count, "S").End(xlUp).Offset(Range("U8").Value, 0).Select


--

HTH

RP
(remove nothere from the email address if mailing direct)


"James" wrote in message
...
I'm having a little trouble getting a value of a cell to work as a

variable
in an offset. In the snippet of code below, I am taking the value in cell

R8
and copying it to the first empty cell at the end of column S. Next what

I
want to do is take the same value and copy it "X" cells below and then

fill
the value between the two points. The value I want to basically go down

(and
use in the second offset) is in cell "U8". I can't for whatever reason

get
the second offset to work with a variable. Thank you for any help you can
provide!

James

Range("R8").Select
Selection.Copy
Cells(Rows.Count, "S").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("R8").Select
Selection.Copy
Cells(Rows.Count, "S").End(xlUp).Offset(U8, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Cells(Rows.Count, "S").End(xlUp).Offset(1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown




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
VLookup Variable Offset Glenda Excel Discussion (Misc queries) 1 April 7th 10 02:01 PM
Sum variable range of column entries in offset cell Struggling in Sheffield[_2_] New Users to Excel 5 October 10th 09 05:16 PM
Variable worksheet name in offset Dave T Excel Worksheet Functions 2 January 25th 07 07:41 PM
Transpose? Offset? Variable starting cell Fin Analyst Excel Discussion (Misc queries) 4 April 26th 06 07:48 AM
How to Offset string variable? Alan Ibbotson Excel Programming 2 May 9th 04 09:22 PM


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