Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
MINAL ZUNKE
 
Posts: n/a
Default save original data after macro is run again

Hi
Experts

I have developed a macro which imports data from another excel file.
Ex: consider I have 2 excel files A & B.
I run macro in file A today, it copies whatever data from file B.
say 20 rows have been filled in file A(starting from A5 to A25). I do some
changes on the file A which has few conditional formatting and forlumas.
I re-run the macro after 8 days in file A to get the new updated data from
file B.

The problem I am facing is
"If I re-run the macro, it deletes the data from file A. It pastes
everything starting from top left cell.
When I generated macro in file A, I have selected top left cell while
recording macro.

My requirement::::::
Now I want the macro to put the data from the cell A27 onwards and also
retain the changes to the data from Cell A5 to A25.
So everytime I run the macro it should add data to the excel file from the
available blank cell and not copy over the same data.

Thnanking in anticipation
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Minal,

Posting your code would help. But, perhaps a change from code like:

Range("A5").Select

to

Range("A65536").End(xlUp)(2).Select

will fix that problem.

HTH,
Bernie
MS Excel MVP


"MINAL ZUNKE" wrote in message
...
Hi
Experts

I have developed a macro which imports data from another excel file.
Ex: consider I have 2 excel files A & B.
I run macro in file A today, it copies whatever data from file B.
say 20 rows have been filled in file A(starting from A5 to A25). I do some
changes on the file A which has few conditional formatting and forlumas.
I re-run the macro after 8 days in file A to get the new updated data from
file B.

The problem I am facing is
"If I re-run the macro, it deletes the data from file A. It pastes
everything starting from top left cell.
When I generated macro in file A, I have selected top left cell while
recording macro.

My requirement::::::
Now I want the macro to put the data from the cell A27 onwards and also
retain the changes to the data from Cell A5 to A25.
So everytime I run the macro it should add data to the excel file from the
available blank cell and not copy over the same data.

Thnanking in anticipation



  #3   Report Post  
MINAL ZUNKE
 
Posts: n/a
Default

hi Bernie

I have pasted code here

Windows("Qry_CNC MILL_JOB.xls").Activate
Range("A2:E100").Select
ActiveWindow.SmallScroll Down:=-87
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
Selection.Copy
Windows("job status xcel.xls").Activate
Range("A5").Select
ActiveSheet.Paste
Range("F7").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub

I hope to have a workable solution from you.
thnx


"Bernie Deitrick" wrote:

Minal,

Posting your code would help. But, perhaps a change from code like:

Range("A5").Select

to

Range("A65536").End(xlUp)(2).Select

will fix that problem.

HTH,
Bernie
MS Excel MVP


"MINAL ZUNKE" wrote in message
...
Hi
Experts

I have developed a macro which imports data from another excel file.
Ex: consider I have 2 excel files A & B.
I run macro in file A today, it copies whatever data from file B.
say 20 rows have been filled in file A(starting from A5 to A25). I do some
changes on the file A which has few conditional formatting and forlumas.
I re-run the macro after 8 days in file A to get the new updated data from
file B.

The problem I am facing is
"If I re-run the macro, it deletes the data from file A. It pastes
everything starting from top left cell.
When I generated macro in file A, I have selected top left cell while
recording macro.

My requirement::::::
Now I want the macro to put the data from the cell A27 onwards and also
retain the changes to the data from Cell A5 to A25.
So everytime I run the macro it should add data to the excel file from the
available blank cell and not copy over the same data.

Thnanking in anticipation




  #4   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Change

Range("A5").Select
ActiveSheet.Paste


to

Range("A65536").End(xlUp)(2).Select
ActiveSheet.Paste

Bernie


"MINAL ZUNKE" wrote in message
...
hi Bernie

I have pasted code here

Windows("Qry_CNC MILL_JOB.xls").Activate
Range("A2:E100").Select
ActiveWindow.SmallScroll Down:=-87
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 1
End With
Selection.Copy
Windows("job status xcel.xls").Activate
Range("A5").Select
ActiveSheet.Paste
Range("F7").Select
Application.CutCopyMode = False
ActiveWorkbook.Save
End Sub

I hope to have a workable solution from you.
thnx


"Bernie Deitrick" wrote:

Minal,

Posting your code would help. But, perhaps a change from code like:

Range("A5").Select

to

Range("A65536").End(xlUp)(2).Select

will fix that problem.

HTH,
Bernie
MS Excel MVP


"MINAL ZUNKE" wrote in message
...
Hi
Experts

I have developed a macro which imports data from another excel file.
Ex: consider I have 2 excel files A & B.
I run macro in file A today, it copies whatever data from file B.
say 20 rows have been filled in file A(starting from A5 to A25). I do
some
changes on the file A which has few conditional formatting and
forlumas.
I re-run the macro after 8 days in file A to get the new updated data
from
file B.

The problem I am facing is
"If I re-run the macro, it deletes the data from file A. It pastes
everything starting from top left cell.
When I generated macro in file A, I have selected top left cell while
recording macro.

My requirement::::::
Now I want the macro to put the data from the cell A27 onwards and
also
retain the changes to the data from Cell A5 to A25.
So everytime I run the macro it should add data to the excel file from
the
available blank cell and not copy over the same data.

Thnanking in anticipation






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
Excel could not save all the data and formatting you recently ad.. Houndstooth Excel Worksheet Functions 0 April 18th 05 03:05 PM
Using a MACRO to sort data BAM718 Excel Worksheet Functions 5 April 16th 05 01:40 PM
help with macro to save repeating data entry Tom Excel Discussion (Misc queries) 0 February 16th 05 04:24 AM
Pulling data from 1 sheet to another Dave1155 Excel Worksheet Functions 1 January 12th 05 05:55 PM
I need a macro to find cut and paste data to new cell Rex Excel Discussion (Misc queries) 0 December 6th 04 12:45 AM


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

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"