Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Code to copy formula to variable range

Toppers

Thanks - actually got round the problem with some code in Access!

Regards

"Toppers" wrote:

Bad day at the office! Sorry

Sub CopyDown()

'
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("B1").Select
Selection.AutoFill Destination:=Range("B1:B" & lastrow),
Type:=xlFillDefault
Range("B1:B" & lastrow).Copy
Range("B1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns(1).Delete
End Sub

"Toppers" wrote:

Hi,


Sub CopyDown()

'
Dim lastrow As Long
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1:B1").Select
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Selection.AutoFill Destination:=Range("A1:B" & lastrow),
Type:=xlFillDefault
Range("B1:B" & lastrow).Copy
Range("B1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Columns(1).Delete
End Sub

"Snowsride" wrote:

I have a spreadsheet that will contain entries in Column A but the number of
rows will vary. In Cell B1 I have a formula based on Cell A1 that I want to
copy down in Column B to the last row of the data in Column A. I then need
to change the formulae in Column B to values and delete Column A.

I need some code to do this.

Grateful for any 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
VBA help to copy variable range Eduardo Excel Discussion (Misc queries) 7 August 18th 08 09:16 PM
Macro to copy a specified range to a variable range SWT Excel Programming 4 October 21st 05 08:24 PM
VBA Code to name a variable range John Excel Programming 6 July 14th 05 05:15 PM
how do I hard code a variable range for a pivot table in vba? havocdragon Excel Programming 1 June 29th 05 10:21 PM
Code to copy range vs Copy Entire Worksheet - can't figure it out Mike Taylor Excel Programming 1 April 15th 04 08:34 PM


All times are GMT +1. The time now is 02:57 AM.

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"