Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy and paste

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default copy and paste

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy and paste

Tom I am getting an error when I try to run this program.
It is highlighting this line:
If IsNumeric(Sh1.Cells(i, 0)) Then


"Tom Ogilvy" wrote:

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default copy and paste

I can't imagine why I put a zero in there, but it should be a 1 in all cases

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,1)) then
if sh1.cells(i,1) 0 then
rng2(j).Value = sh1.cells(i,1).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy



"enyaw" wrote:

Tom I am getting an error when I try to run this program.
It is highlighting this line:
If IsNumeric(Sh1.Cells(i, 0)) Then


"Tom Ogilvy" wrote:

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy and paste

Tom

How can I get this program to copy over more than just one column?
I also need to copy over the format of the text.


"Tom Ogilvy" wrote:

I can't imagine why I put a zero in there, but it should be a 1 in all cases

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,1)) then
if sh1.cells(i,1) 0 then
rng2(j).Value = sh1.cells(i,1).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy



"enyaw" wrote:

Tom I am getting an error when I try to run this program.
It is highlighting this line:
If IsNumeric(Sh1.Cells(i, 0)) Then


"Tom Ogilvy" wrote:

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default copy and paste

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,1)) then
if sh1.cells(i,1) 0 then
sh1.cells(i,1).entirerow.copy
rng2(j).Pastespecial xlValues
rng2(j).Pastespecial xlFormats
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy



"enyaw" wrote:

Tom

How can I get this program to copy over more than just one column?
I also need to copy over the format of the text.


"Tom Ogilvy" wrote:

I can't imagine why I put a zero in there, but it should be a 1 in all cases

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,1)) then
if sh1.cells(i,1) 0 then
rng2(j).Value = sh1.cells(i,1).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy



"enyaw" wrote:

Tom I am getting an error when I try to run this program.
It is highlighting this line:
If IsNumeric(Sh1.Cells(i, 0)) Then


"Tom Ogilvy" wrote:

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default copy and paste

Is there a way of changing the formula so it picks up text instead of copying
just the numbers?

"enyaw" wrote:

Tom

How can I get this program to copy over more than just one column?
I also need to copy over the format of the text.


"Tom Ogilvy" wrote:

I can't imagine why I put a zero in there, but it should be a 1 in all cases

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,1)) then
if sh1.cells(i,1) 0 then
rng2(j).Value = sh1.cells(i,1).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy



"enyaw" wrote:

Tom I am getting an error when I try to run this program.
It is highlighting this line:
If IsNumeric(Sh1.Cells(i, 0)) Then


"Tom Ogilvy" wrote:

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?

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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
Copy and Paste macro needs to paste to a changing cell reference loulou Excel Programming 0 February 24th 05 10:29 AM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


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