RE: complex copy and paste
- From: Hawkdriver <Hawkdriver@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 4 Jan 2007 04:04:00 -0800
Thank you tom for replying:
After trying to work with your suggestion here is the rest of my problem:
All the cells in wb 1 & 2 are merged rows and columns so i am working with a
range instead of a single cell. The starting row number in wb1 where the
data is coming from changes and is not always the same (another input box for
start row?). Workbook 2 ranges will always be the same. The macro is in my
personal.xls workbook so i was trying to use workbooks(2) & (3) to move
between the sheets. The cells are merged rows of 2 like-(E20:G21) here is
what the ranges would look like in the first row of wb1:
(E20:S21) & (T20:X21)-this is what i want merged in (A20:A21)of wb2 and
(Y20:AJ21) & (AK20:AN21) in (C20:C21) in wb2. This would be "1 row" worth of
data.
Many thanks
hawkdriver@xxxxxxxxxxxxx
Jason
"Tom Ogilvy" wrote:
Sub copydata().
Dim sh1 as work***, sh2 as work***
Dim numrows as string
sh1 = Workbooks("Book1.xls").Worksheets("sheet1")
sh2 = Workbooks("Book2.xls").Worksheets("Sheet1")
numrows = Application.InputBox("Enter number of rows")
if isnumber(numrows) then
for i = 1 to int(numrows)
sh2.Cells(i,1) = sh1.Cells(i,1).Text & " " & sh1.cells(i,2).Text
next
end if
End sub
Saying Merged cell is ambiguous. two cells are merged, 5 cells are merged,
across rows, down columns? Where is cell1, where is cell2
in the example, it goes down column A and gets values from column A and
column B for each row up to numrows. Using the .Text property returns a
formatted string.
--
Regards,
Tom Ogilvy
"Hawkdriver" wrote:
I am trying to copy and paste from two different workbooks but I need to
format the data before the paste.
Workbook1 has a varying range of rows that contains the data that I need,
cell 1 is a merged cell with dropdown list of choices and contains data that
looks like this:
Any Town USA
( gps coordinate )
And cell 2 - 24hr time:
14:50
I need to merge that data into workbook2 into a single cell so that the data
looks like:
Any Town USA 14:50
I would also like to be able to input the number of rows in wb1 that need to
be copied to wb2 with a txtbox at the beginning of the macro
Thanks
- Follow-Ups:
- Re: complex copy and paste
- From: Tom Ogilvy
- Re: complex copy and paste
- Prev by Date: Re: ctrl+break when modeless
- Next by Date: Pivot Date criteria
- Previous by thread: Re: Move down 1 cell after going to the end of my data.
- Next by thread: Re: complex copy and paste
- Index(es):
Loading