Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Using a formula in a macro

I have the following macro (simplified, of course):
==================
Sub Macro1()
Macro1 Macro
Keyboard Shortcut: Ctrl+s
Range("A1:a15").Select
Selection.Copy
End Sub
====================
I would like to substitute a formula (match("the end",A1:a100)) for the
"a15", but can't find the correct syntax.

Can anyone help?

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Using a formula in a macro

Hi,

Is this what you mean

lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A1:a" & lastrow).Select


--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Al @ Frontier" wrote:

I have the following macro (simplified, of course):
==================
Sub Macro1()
Macro1 Macro
Keyboard Shortcut: Ctrl+s
Range("A1:a15").Select
Selection.Copy
End Sub
====================
I would like to substitute a formula (match("the end",A1:a100)) for the
"a15", but can't find the correct syntax.

Can anyone help?

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 135
Default Using a formula in a macro

Al -

Substitute your range statement for these two:

Range("A1").Select
Range(Selection, Selection.End(xlDown)).Select


--
Daryl S


"Al @ Frontier" wrote:

I have the following macro (simplified, of course):
==================
Sub Macro1()
Macro1 Macro
Keyboard Shortcut: Ctrl+s
Range("A1:a15").Select
Selection.Copy
End Sub
====================
I would like to substitute a formula (match("the end",A1:a100)) for the
"a15", but can't find the correct syntax.

Can anyone help?

Thanks.

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
Formula Macro Secret Squirrel Excel Discussion (Misc queries) 7 January 27th 07 04:16 PM
Macro Formula for Max value John Bundy Excel Worksheet Functions 0 November 30th 06 05:25 PM
Help with a macro/formula brefed15 Excel Worksheet Functions 5 June 19th 06 08:19 PM
Macro and Formula strung Excel Worksheet Functions 3 September 6th 05 02:43 PM
how to run a macro from a formula? davidhub Excel Discussion (Misc queries) 2 July 5th 05 02:42 PM


All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"