#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default macro help pls

Hello everybody. I need help to modify the macro below
Range("A7").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, ActiveCell.End(xlToRight)).Select
Selection.Clear
Range("A6").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("A7:A41").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

In Range("A7:A41").Select; instead of A41 i want to change it A(value in
B2). The value in B2 changes. So i would like to erase the existing
formulae from A7: ,and copy the formulae.selection from A7:A(B2).
Any suggestions.
Thank you to all
With regards
Sridhar
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 523
Default macro help pls

Replace 'Range("A7:A41")' in your macro with
'Range("a7").resize(range("b2").value-6,1).Select'


"yshridhar" wrote:

Hello everybody. I need help to modify the macro below
Range("A7").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, ActiveCell.End(xlToRight)).Select
Selection.Clear
Range("A6").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("A7:A41").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

In Range("A7:A41").Select; instead of A41 i want to change it A(value in
B2). The value in B2 changes. So i would like to erase the existing
formulae from A7: ,and copy the formulae.selection from A7:A(B2).
Any suggestions.
Thank you to all
With regards
Sridhar

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 229
Default macro help pls

Thanks alot Mr. Pascal for your micro reply and for your suggestion.
It works for me and that is what i want.
regards
Sridhar

"papou" wrote:

Hello Sridhar

Range("A7:A" & [B2]).Select

But note that selection of cells is not necessary.
You could use somtehing like:
Range("A6", Range("A6").End(xlToRight)).Copy Range("A7")
Since you only need to specify the first cell receiving the copy

HTH
Cordially
Pascal

"yshridhar" a écrit dans le message de
news: ...
Hello everybody. I need help to modify the macro below
Range("A7").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, ActiveCell.End(xlToRight)).Select
Selection.Clear
Range("A6").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Range("A7:A41").Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub

In Range("A7:A41").Select; instead of A41 i want to change it A(value in
B2). The value in B2 changes. So i would like to erase the existing
formulae from A7: ,and copy the formulae.selection from A7:A(B2).
Any suggestions.
Thank you to all
With regards
Sridhar




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 Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


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