Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell

I have a macro in which I want to copy a value from a cell in Workbook
A to a cell in Workbook B.. However,when pasting it into Workbook B, I
want to add it to the previous value.. Simply pasting it replaces the
value. Is there a way to paste a value while adding it to the previous
value ??

Any help will be greatly appreciated.. Thanks a lot to all the experts
out there..!! I'm copying the code of the macro below.. macro sits in
workbook A :-



Sub OrderingList_Click()

Workbooks.Open Filename:="Workbook B.xls"
Sheets("Delays").Select
Range("n36").Select


For i = 36 To 300
Set curCell = Worksheets("Delays").Cells(i, 14)



If curCell.Value = "Marine Logistics" Then
curCell.Offset(0, 2).Select

End If

Selection.Copy


Windows("Workbook A.xls").Activate
Range("e10").Select

Selection.PasteSpecial Paste:=xlValues ' This replaces the value
each time.code which can add to prev value?



Windows("Workbook B.xls").Activate
'ActiveCell.Offset(0, -2).Select

Next i

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell

One way:

Public Sub OrderingList_Click()
Dim dAdd As Double

With Workbooks.Open(Filename:="Workbook B.xls")
With Sheets("Delays").Range("N6:N300")
dAdd = Application.WorksheetFunction.SumIf( _
.Cells, "Marine Logistics", .Offset(0, 2))
End With
End With
With Workbooks("Workbook A.xls").Sheets("Sheet1").Range("E10")
.Value = .Value + dAdd
End With
End Sub

Change "Sheet1" to the name of your sheet in Workbook A.xls, if needed

In article .com,
wrote:

I have a macro in which I want to copy a value from a cell in Workbook
A to a cell in Workbook B.. However,when pasting it into Workbook B, I
want to add it to the previous value.. Simply pasting it replaces the
value. Is there a way to paste a value while adding it to the previous
value ??

Any help will be greatly appreciated.. Thanks a lot to all the experts
out there..!! I'm copying the code of the macro below.. macro sits in
workbook A :-



Sub OrderingList_Click()

Workbooks.Open Filename:="Workbook B.xls"
Sheets("Delays").Select
Range("n36").Select


For i = 36 To 300
Set curCell = Worksheets("Delays").Cells(i, 14)



If curCell.Value = "Marine Logistics" Then
curCell.Offset(0, 2).Select

End If

Selection.Copy


Windows("Workbook A.xls").Activate
Range("e10").Select

Selection.PasteSpecial Paste:=xlValues ' This replaces the value
each time.code which can add to prev value?



Windows("Workbook B.xls").Activate
'ActiveCell.Offset(0, -2).Select

Next i

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default How can I copy a value from a cell and paste it into another cell while adding it to the previous value in that cell

On Oct 31, 6:43 pm, JE McGimpsey wrote:
One way:

Public Sub OrderingList_Click()
Dim dAdd As Double

With Workbooks.Open(Filename:="Workbook B.xls")
With Sheets("Delays").Range("N6:N300")
dAdd = Application.WorksheetFunction.SumIf( _
.Cells, "Marine Logistics", .Offset(0, 2))
End With
End With
With Workbooks("Workbook A.xls").Sheets("Sheet1").Range("E10")
.Value = .Value + dAdd
End With
End Sub

Change "Sheet1" to the name of your sheet in Workbook A.xls, if needed

In article .com,



wrote:
I have a macro in which I want to copy a value from a cell in Workbook
A to a cell in Workbook B.. However,when pasting it into Workbook B, I
want to add it to the previous value.. Simply pasting it replaces the
value. Is there a way to paste a value while adding it to the previous
value ??


Any help will be greatly appreciated.. Thanks a lot to all the experts
out there..!! I'm copying the code of the macro below.. macro sits in
workbook A :-


Sub OrderingList_Click()


Workbooks.Open Filename:="Workbook B.xls"
Sheets("Delays").Select
Range("n36").Select


For i = 36 To 300
Set curCell = Worksheets("Delays").Cells(i, 14)


If curCell.Value = "Marine Logistics" Then
curCell.Offset(0, 2).Select


End If


Selection.Copy


Windows("Workbook A.xls").Activate
Range("e10").Select


Selection.PasteSpecial Paste:=xlValues ' This replaces the value
each time.code which can add to prev value?


Windows("Workbook B.xls").Activate
'ActiveCell.Offset(0, -2).Select


Next i


End Sub- Hide quoted text -


- Show quoted text -


Hi,

I would like someone to help me out on this.

I have 2 sheets in excel, one is named as "Summarised Statement" and
the other one as "Report"

In Summaried statement, I have the Column A loaded with ID starting
from 1,2,3........ and so on downwards. These ID's are hyper linked
to the Sheet"Report" Cell. L3.

Now what I want is that, when I click on the Hyperlink ID's, the value
if the clicked cell should appear on "Report Cell.L3" .

Thank you for your time on helping me out.

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
auto populate cell based on previous cell drop down list selectio. PuzzledbyLists Excel Discussion (Misc queries) 2 September 11th 06 01:28 AM
Adding 2 cells together and paste into 1 cell Steved Excel Worksheet Functions 4 June 29th 06 08:18 PM
formula, move to previous cell when the current cell=0 or empty osama amer Excel Discussion (Misc queries) 0 May 29th 06 12:18 PM
conditional cell format based on cell in same row, previous column tamiluchi Excel Worksheet Functions 7 May 3rd 06 04:11 PM
Select cell, Copy it, Paste it, Return to Previous cell spydor Excel Discussion (Misc queries) 1 December 30th 05 02:29 PM


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