|
-
Apr 26th, 2011, 12:07 AM
#1
Thread Starter
New Member
Thread linking question
We have a series of worksheets, ex 4. On each work sheet (1,2,3) there is some information that I need to move onto work sheet 4.
I need to take the info from Cells "A1" "F30" "E30" on work sheets 1-3 and paste them on work sheet 4 under "A" "B" and "C"
I need to take the value (actual number), not formula, of "E30"
This is what I have so far, any help would be appreciated.
Code:
Sub x()
Dim ws As Worksheet
Dim i As Integer
Sheet4.Cells.Clear
For i = 1 To 3
Sheets(i).UsedRange.Range("A1").Copy Sheets("Total").Range("A" & Rows.Count).End(xlUp)(2)
Sheets(i).UsedRange.Range("B4").Copy Sheets("Total").Range("B" & Rows.Count).End(xlUp)(2)
Sheets(i).UsedRange.Range("D4").Copy Sheets("Total").Range("C" & Rows.Count).End(xlUp)(2)
Next i
End Sub
-
Apr 26th, 2011, 03:15 AM
#2
Re: Thread linking question
no need to copy and paste, just assign the values
vb Code:
Sheets("Total").Range("A" & Rows.Count).End(xlUp)(2) = Sheets(i).UsedRange.Range("A1")
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Apr 26th, 2011, 08:13 AM
#3
Thread Starter
New Member
Re: Thread linking question
 Originally Posted by westconn1
no need to copy and paste, just assign the values
vb Code:
Sheets("Total").Range("A" & Rows.Count).End(xlUp)(2) = Sheets(i).UsedRange.Range("A1")
Thank you, but now for some reason it won't copy the contents of cells E30 and F30 (numbers) only of A1 (text).
Also E30 and F30 are formulas consisting of Sum(E2:E29) and I would like to only copy the value in those two cells and not the formula. Do I need to use the 'pastespecial' command?
-
Apr 26th, 2011, 04:14 PM
#4
Re: Thread linking question
Do I need to use the 'pastespecial' command?
there should be no need
it should just copy the value, not the formula, i have tested here, works correctly
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|