LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default record formulas

Keep track of what you copy...


dim RngToCopy as range
dim DestCell as range
dim CSVWkbk as workbook

with workbooks("destination.xls").worksheets("Input")
set destcell = .range("a265")
end with

set csvwkbk = Workbooks.Open(filename:="source.csv")

with csvwkbk.worksheets(1)
If .Range("A2").Value 0 Then 'file not empty
set rngtocopy = .Range("A2", Range("M2").End(xlDown))
rngtocopy.copy _
destination:=destcell
destcell.offset(0,13).resize(rngtocopy.rows.count, 1).formular1c1 _
= "=someformulahere"
end if
end with

csvwkbk.close savechanges:=false

=====
Untested, uncompiled.

geebee wrote:

hi,

I have the following:

Workbooks.Open "source.csv"
DisplayAlerts = False
If Range("A2").Value 0 Then 'file not empty
Range(Range("A2"), Range("M2").End(xlDown)).Select
Range(Range("A2"), Range("M2").End(xlDown)).Copy
'Application.CutCopyMode = True 'prevent the following prompt: "There is
a large amount of information on the clipboard. Do yo uwant to be able to
paste this information into another program later?"
Application.ActiveWorkbook.Close savechanges:=False ' No need to save here
End If

'paste data from csv file, starting at row 265
Windows("destination.xls").Activate
Sheets("Input").Select
Range("A265").Select
ActiveSheet.Paste

Now I need to know how to make sure that all of the pasted rows have
formulas for column N. I could simply do a paste of the formula for the
whole column, but this would make empty records below the pasted records have
formulas also. How can I make sure that all of the pasted rows have formulas
for column N...and if not, paste the formula?

Thanks in advance,
geebee


--

Dave Peterson
 
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
I need to have a record number change for every record Puget Sound Courier Service Excel Discussion (Misc queries) 1 July 12th 09 03:32 PM
Open new record with selected fields from previous record Design by Sue Excel Discussion (Misc queries) 1 June 12th 09 02:24 PM
Finding last record in month for each of several types of record. Richard Buttrey Excel Programming 5 April 4th 05 02:11 AM
Record Macro - Record custom user actions Sal[_4_] Excel Programming 1 December 23rd 04 03:18 PM
Need help autopopulating next new record with previous record data Harry S[_3_] Excel Programming 2 October 1st 03 10:59 PM


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