Welcome to the { mindfrost82.com } forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-17-2008, 09:58 AM
shiro
 
Posts: n/a
Transferring data to new workbook.

Hi All,
I want to transferring a data automatically by using
vba code.But need soeone to point me the right
direction.What I want to do is something simple.
I want the code to run if it meet some condition.

If a cell in column F:F have value >1 and not empty (""),
I want the code to collect the entire data on every cell
on the left to be copied and paste into a new workbook.

And how to handle if there are some cell that have
value >1.How to copy the recordset and paste it into
a new workbook.And maybe I also need a message
box to tell the user that there is no data will be copied
if there is no cell in range F:F that contains value >1.

New workbook maybe need a header something like:
" Wrong data list ".

I have read automation transfer data to workbook
from MS Help and Support,but since I'm a new user,
I'm still cannot modified the code as I need.I'm still
need more simpler sample and lesson.

Thank's and Rgds,

Shiro.




Reply With Quote
  #2 (permalink)  
Old 05-17-2008, 12:29 PM
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
 
Posts: n/a
RE: Transferring data to new workbook.

This is a very good problem for using the Macro Recorder. Say we have two
workbooks open Book1.xks and Book2.xls

In Sheet1 of Book1 we have:

qewr gd bd br t evv
-2 0 8 0 2 -8
5 -1 -2 0 -3 -10
6 1 8 2 8 4
-6 -4 8 6 4 -3
-9 2 -3 -10 3 2
7 6 5 -1 -2 1
9 -1 -7 10 4 -8
1 -9 -8 -7 -2 6
0 -10 9 7 -3 -5
4 -3 -3 7 -5 10
-9 -4 3 2 6 -6
-6 -6 -6 10 10 -6
-2 9 10 3 3 3
10 5 -5 6 -3 6
3 3 0 6 6 0
-10 -4 -7 0 -4 7
-9 10 4 10 -7 -3
1 -6 6 -8 -1 4
-9 6 -2 -9 -9 1
9 -5 -10 8 2 9
2 -9 -9 7 0 -8
8 1 -7 -10 -5 8
10 9 -7 7 5 5
0 1 4 7 5 -1
1 1 2 4 8 -8
8 -9 4 -2 -3 8
7 -9 -8 5 -2 8
1 -8 -6 -2 6 9
6 0 9 6 10 -10

To do the transfer manually, we click on F1 and:

Data > Filter > AutoFilter...
Custom > is greater than > 1

This displays:

qewr gd bd br t evv
6 1 8 2 8 4
-9 2 -3 -10 3 2
1 -9 -8 -7 -2 6
4 -3 -3 7 -5 10
-2 9 10 3 3 3
10 5 -5 6 -3 6
-10 -4 -7 0 -4 7
1 -6 6 -8 -1 4
9 -5 -10 8 2 9
8 1 -7 -10 -5 8
10 9 -7 7 5 5
8 -9 4 -2 -3 8
7 -9 -8 5 -2 8
1 -8 -6 -2 6 9

and we would manually copy/paste to Book2.xls

Let's do this with the Recorder turned on:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/17/2008 by James Ravenswood
'

'
Range("F1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=6, Criteria1:=">1", Operator:=xlAnd
Range("A1:F29").Select
Selection.Copy
Windows("Book2").Activate
Range("A1").Select
ActiveSheet.Paste
End Sub

The only manual issue we face is correctly adjusting the F29.
--
Gary''s Student - gsnu200786


"shiro" wrote:

> Hi All,
> I want to transferring a data automatically by using
> vba code.But need soeone to point me the right
> direction.What I want to do is something simple.
> I want the code to run if it meet some condition.
>
> If a cell in column F:F have value >1 and not empty (""),
> I want the code to collect the entire data on every cell
> on the left to be copied and paste into a new workbook.
>
> And how to handle if there are some cell that have
> value >1.How to copy the recordset and paste it into
> a new workbook.And maybe I also need a message
> box to tell the user that there is no data will be copied
> if there is no cell in range F:F that contains value >1.
>
> New workbook maybe need a header something like:
> " Wrong data list ".
>
> I have read automation transfer data to workbook
> from MS Help and Support,but since I'm a new user,
> I'm still cannot modified the code as I need.I'm still
> need more simpler sample and lesson.
>
> Thank's and Rgds,
>
> Shiro.
>
>
>
>
>

Reply With Quote
  #3 (permalink)  
Old 05-17-2008, 01:36 PM
shiro
 
Posts: n/a
Re: Transferring data to new workbook.

Sorry Gary,
not so understand.Please more guidance.
What about the cell value in the left?


"Gary''s Student" <GarysStudent@discussions.microsoft.com> wrote in message
news:815C496A-B8AD-441D-98CF-59CD200B8CCB@microsoft.com...
> This is a very good problem for using the Macro Recorder. Say we have two
> workbooks open Book1.xks and Book2.xls
>
> In Sheet1 of Book1 we have:
>
> qewr gd bd br t evv
> -2 0 8 0 2 -8
> 5 -1 -2 0 -3 -10
> 6 1 8 2 8 4
> -6 -4 8 6 4 -3
> -9 2 -3 -10 3 2
> 7 6 5 -1 -2 1
> 9 -1 -7 10 4 -8
> 1 -9 -8 -7 -2 6
> 0 -10 9 7 -3 -5
> 4 -3 -3 7 -5 10
> -9 -4 3 2 6 -6
> -6 -6 -6 10 10 -6
> -2 9 10 3 3 3
> 10 5 -5 6 -3 6
> 3 3 0 6 6 0
> -10 -4 -7 0 -4 7
> -9 10 4 10 -7 -3
> 1 -6 6 -8 -1 4
> -9 6 -2 -9 -9 1
> 9 -5 -10 8 2 9
> 2 -9 -9 7 0 -8
> 8 1 -7 -10 -5 8
> 10 9 -7 7 5 5
> 0 1 4 7 5 -1
> 1 1 2 4 8 -8
> 8 -9 4 -2 -3 8
> 7 -9 -8 5 -2 8
> 1 -8 -6 -2 6 9
> 6 0 9 6 10 -10
>
> To do the transfer manually, we click on F1 and:
>
> Data > Filter > AutoFilter...
> Custom > is greater than > 1
>
> This displays:
>
> qewr gd bd br t evv
> 6 1 8 2 8 4
> -9 2 -3 -10 3 2
> 1 -9 -8 -7 -2 6
> 4 -3 -3 7 -5 10
> -2 9 10 3 3 3
> 10 5 -5 6 -3 6
> -10 -4 -7 0 -4 7
> 1 -6 6 -8 -1 4
> 9 -5 -10 8 2 9
> 8 1 -7 -10 -5 8
> 10 9 -7 7 5 5
> 8 -9 4 -2 -3 8
> 7 -9 -8 5 -2 8
> 1 -8 -6 -2 6 9
>
> and we would manually copy/paste to Book2.xls
>
> Let's do this with the Recorder turned on:
>
> Sub Macro1()
> '
> ' Macro1 Macro
> ' Macro recorded 5/17/2008 by James Ravenswood
> '
>
> '
> Range("F1").Select
> Selection.AutoFilter
> Selection.AutoFilter Field:=6, Criteria1:=">1", Operator:=xlAnd
> Range("A1:F29").Select
> Selection.Copy
> Windows("Book2").Activate
> Range("A1").Select
> ActiveSheet.Paste
> End Sub
>
> The only manual issue we face is correctly adjusting the F29.
> --
> Gary''s Student - gsnu200786
>
>
> "shiro" wrote:
>
> > Hi All,
> > I want to transferring a data automatically by using
> > vba code.But need soeone to point me the right
> > direction.What I want to do is something simple.
> > I want the code to run if it meet some condition.
> >
> > If a cell in column F:F have value >1 and not empty (""),
> > I want the code to collect the entire data on every cell
> > on the left to be copied and paste into a new workbook.
> >
> > And how to handle if there are some cell that have
> > value >1.How to copy the recordset and paste it into
> > a new workbook.And maybe I also need a message
> > box to tell the user that there is no data will be copied
> > if there is no cell in range F:F that contains value >1.
> >
> > New workbook maybe need a header something like:
> > " Wrong data list ".
> >
> > I have read automation transfer data to workbook
> > from MS Help and Support,but since I'm a new user,
> > I'm still cannot modified the code as I need.I'm still
> > need more simpler sample and lesson.
> >
> > Thank's and Rgds,
> >
> > Shiro.
> >
> >
> >
> >
> >



Reply With Quote
Reply

  { mindfrost82.com } > Gadget Corner > Tech Newsgroups > Microsoft > MS Office > Excel


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:02 PM.


Powered by vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
© 1999-2008 mindfrost82.com v11.0


Sponsors:
Online Loans | Equity Release | Home Loan | Loans | Loans



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114