Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Finding range

Hello,

i'm having a small problem...

i need to find the last cell with data in collum E.

and then copy a a pre determent string in a range
from G2 to Gxx where the xx the last row of collum E is.

thanks for all the help..

Swingleft..




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Finding range

sub flrc()
dim lr as long
lr=cells(rows.count,"e").end(xlup).row
cells(2,"g").resize(lr-1).copy range("h1")
end sub


On Nov 7, 7:00*am, "Swingleft" wrote:
Hello,

i'm having a small problem...

i need to find the last cell with data in collum E.

and then copy a a pre determent string in a range
from G2 to Gxx where the xx the last row of collum E is.

thanks for all the help..

Swingleft..


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Finding range

Hi Don,

thanks for trying to help..
can you explain what the .resize does..
and how i can get the value "help" (for instance)
in the range G2 to Gxx

the .copy range("h1") isn't working :-(..

thanks..

"Don Guillett" schreef in bericht
...

sub flrc()
dim lr as long
lr=cells(rows.count,"e").end(xlup).row
cells(2,"g").resize(lr-1).copy range("h1")
end sub


On Nov 7, 7:00 am, "Swingleft" wrote:
Hello,

i'm having a small problem...

i need to find the last cell with data in collum E.

and then copy a a pre determent string in a range
from G2 to Gxx where the xx the last row of collum E is.

thanks for all the help..

Swingleft..


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Finding range

On Mon, 7 Nov 2011 14:00:44 +0100, "Swingleft" wrote:

Hello,

i'm having a small problem...

i need to find the last cell with data in collum E.

and then copy a a pre determent string in a range
from G2 to Gxx where the xx the last row of collum E is.

thanks for all the help..

Swingleft..




If what you want is to return the string in Gxx where xx is the last row of data in column E, that can also be done simply with a worksheet formula:

=LOOKUP(2,1/(LEN($E:$E)1),$G:$G)

If you must do it in code, using the Range.Copy method and Pasting the result to a new destination, something like:

==============
Option Explicit
Sub GString()
Dim rg As Range
Set rg = Cells(Cells.Rows.Count, "E").End(xlUp).Offset(columnoffset:=2)
rg.Copy Destination:=Range("J1")
End Sub
===================
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Finding range

On Tue, 08 Nov 2011 07:04:06 -0500, Ron Rosenfeld wrote:

On Mon, 7 Nov 2011 14:00:44 +0100, "Swingleft" wrote:

Hello,

i'm having a small problem...

i need to find the last cell with data in collum E.

and then copy a a pre determent string in a range
from G2 to Gxx where the xx the last row of collum E is.

thanks for all the help..

Swingleft..




If what you want is to return the string in Gxx where xx is the last row of data in column E, that can also be done simply with a worksheet formula:

=LOOKUP(2,1/(LEN($E:$E)1),$G:$G)

If you must do it in code, using the Range.Copy method and Pasting the result to a new destination, something like:

==============
Option Explicit
Sub GString()
Dim rg As Range
Set rg = Cells(Cells.Rows.Count, "E").End(xlUp).Offset(columnoffset:=2)
rg.Copy Destination:=Range("J1")
End Sub
===================



I see from your response to Don that I may have misinterpreted your request. So also try:

=================
Option Explicit
Sub GString()
Dim rg As Range
Const s As String = "HELP"
Set rg = Range("E2", Cells(Cells.Rows.Count, "E").End(xlUp)).Offset(columnoffset:=2)
rg = s
End Sub
=======================


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Finding range

Thanks!!!!!!


this is exactly what i need....

gr.

Swingleft



"Ron Rosenfeld" schreef in bericht
...

On Tue, 08 Nov 2011 07:04:06 -0500, Ron Rosenfeld wrote:

On Mon, 7 Nov 2011 14:00:44 +0100, "Swingleft" wrote:

Hello,

i'm having a small problem...

i need to find the last cell with data in collum E.

and then copy a a pre determent string in a range
from G2 to Gxx where the xx the last row of collum E is.

thanks for all the help..

Swingleft..




If what you want is to return the string in Gxx where xx is the last row of
data in column E, that can also be done simply with a worksheet formula:

=LOOKUP(2,1/(LEN($E:$E)1),$G:$G)

If you must do it in code, using the Range.Copy method and Pasting the
result to a new destination, something like:

==============
Option Explicit
Sub GString()
Dim rg As Range
Set rg = Cells(Cells.Rows.Count, "E").End(xlUp).Offset(columnoffset:=2)
rg.Copy Destination:=Range("J1")
End Sub
===================



I see from your response to Don that I may have misinterpreted your request.
So also try:

=================
Option Explicit
Sub GString()
Dim rg As Range
Const s As String = "HELP"
Set rg = Range("E2", Cells(Cells.Rows.Count,
"E").End(xlUp)).Offset(columnoffset:=2)
rg = s
End Sub
=======================

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,045
Default Finding range

On Tue, 8 Nov 2011 16:09:49 +0100, "Swingleft" wrote:

Thanks!!!!!!


this is exactly what i need....

gr.

Swingleft


Glad to help. Thanks for the feedback.
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
Finding the corresponding value in a range? Zuo Excel Worksheet Functions 4 February 25th 10 12:45 PM
finding a value between a range Susan Excel Worksheet Functions 9 March 6th 07 12:07 AM
Finding the End of a Range BigH Excel Programming 9 February 20th 06 10:02 PM
Finding a value associated with a range Raymond Gallegos Excel Worksheet Functions 5 November 25th 05 08:38 PM
Finding a Range Name James Montgomery Excel Programming 3 November 1st 04 06:16 PM


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