Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default URGENT HELP ON VARIABLE COPYING PLEASE!!!!

Hi,

I am new to all this and learning as I go.

I have created the following macro, which finds the first non empty cell in
a column g, moves one cell to the right (to column h) and then enters a
formula. I then need to copy this fomula into columns i to x. I am having
trouble doing this as the row number that the formula is in will always be
different. I attach what I have done so far:

Range("g24:g65000").Find(Empty).End(xlDown).Select
ActiveCell.Offset(0, 1).Select

ActiveCell.FormulaR1C1 = "=HLOOKUP(RC1,INDIRECT(R5C8),R22C,FALSE)"
Selection.Copy



I'm sure it is very straight forward but really need a helping hand.

Thanks. Jane



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default URGENT HELP ON VARIABLE COPYING PLEASE!!!!

Try something like this:

sub test()
dim x as long
dim y as long

for x=24 to 65000
if cells(x,7).value=0 then
for y=9 to 24
cells(x,y).select
activecell.formula="=[your formula here]"
next y
end if
next x
end sub

"JaneCox" wrote in message
...
Hi,

I am new to all this and learning as I go.

I have created the following macro, which finds the first non empty cell
in
a column g, moves one cell to the right (to column h) and then enters a
formula. I then need to copy this fomula into columns i to x. I am
having
trouble doing this as the row number that the formula is in will always be
different. I attach what I have done so far:

Range("g24:g65000").Find(Empty).End(xlDown).Select
ActiveCell.Offset(0, 1).Select

ActiveCell.FormulaR1C1 = "=HLOOKUP(RC1,INDIRECT(R5C8),R22C,FALSE)"
Selection.Copy



I'm sure it is very straight forward but really need a helping hand.

Thanks. Jane





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default URGENT HELP ON VARIABLE COPYING PLEASE!!!!

Why not set up a variable that holds the original row number you're in and
then based on where you now are it simply adds to it based on where you now
are?

I'm sorry I can;t be more specific, but I'm not sure which part of the code
you;re having issues with.

HTH.

"JaneCox" wrote:

Hi,

I am new to all this and learning as I go.

I have created the following macro, which finds the first non empty cell in
a column g, moves one cell to the right (to column h) and then enters a
formula. I then need to copy this fomula into columns i to x. I am having
trouble doing this as the row number that the formula is in will always be
different. I attach what I have done so far:

Range("g24:g65000").Find(Empty).End(xlDown).Select
ActiveCell.Offset(0, 1).Select

ActiveCell.FormulaR1C1 = "=HLOOKUP(RC1,INDIRECT(R5C8),R22C,FALSE)"
Selection.Copy



I'm sure it is very straight forward but really need a helping hand.

Thanks. Jane



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default URGENT HELP ON VARIABLE COPYING PLEASE!!!!

Thanks Graham. You are a star!

Jane

"Graham Whitehead" wrote:

Try something like this:

sub test()
dim x as long
dim y as long

for x=24 to 65000
if cells(x,7).value=0 then
for y=9 to 24
cells(x,y).select
activecell.formula="=[your formula here]"
next y
end if
next x
end sub

"JaneCox" wrote in message
...
Hi,

I am new to all this and learning as I go.

I have created the following macro, which finds the first non empty cell
in
a column g, moves one cell to the right (to column h) and then enters a
formula. I then need to copy this fomula into columns i to x. I am
having
trouble doing this as the row number that the formula is in will always be
different. I attach what I have done so far:

Range("g24:g65000").Find(Empty).End(xlDown).Select
ActiveCell.Offset(0, 1).Select

ActiveCell.FormulaR1C1 = "=HLOOKUP(RC1,INDIRECT(R5C8),R22C,FALSE)"
Selection.Copy



I'm sure it is very straight forward but really need a helping hand.

Thanks. Jane






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
Macro for copying a value to a variable no. of rows Ian Grega Excel Discussion (Misc queries) 6 April 15th 08 02:48 PM
Copying a variable range Brian Matlack[_9_] Excel Programming 6 October 17th 05 03:16 PM
Copying and Pasting in a different worksheet (Urgent) Lolly[_2_] Excel Programming 4 August 24th 04 02:29 PM
Copying Variable Ranges Tom Ogilvy Excel Programming 3 October 21st 03 02:31 PM
Copying an array variable to a sheet M Rose Excel Programming 0 July 14th 03 12:04 AM


All times are GMT +1. The time now is 04:46 AM.

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"