PC Review


Reply
Thread Tools Rate Thread

Do until problem

 
 
Mouimet
Guest
Posts: n/a
 
      31st Mar 2008
HI,
When I type a associate number the in cell C7 another sheet retrieve all
info and I print this info. I have many associate number and I do not want to
type one by one and print one by one.
I need a macro to do all numbers at once.
The data are in Column B starting at B11
The paste is always at C7.

Example: Copy B11 to C7, do the print and return back to B12. Do copy and
paste to C7, print and go back to b13, etc.
Here the VB. The only problem is to go back one row under the last copy.
Print is ok.
=========================================
Sub doUntil9999999()
'Message wait please
Please_Wait.Show False

' Start selecting associate number
' Start at B11 copy, go to C7 paste value, Print then go to the other
associate
' number if it's not 9999999, Starting at b10 to B400.
' Need to go down 1 row at a time column B and copy each time in Cell C7
this new associate number.
' My problem is after printing the first associate (B11) I can not return
from C7 to the other row

Range("B11").Select
Do Until ActiveCell.Value = 9999999

ActiveCell.Select
Selection.Copy
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

' trouble here How to go back to the last cell
' The function below go under C7
' not after the last associate number B11,b12,b13, etc.

ActiveCell.Offset(1, 0).Select

' Printing here is ok
Application.ScreenUpdating = False
Sheets("Calendrier").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Liste").Select
Application.ScreenUpdating = True
Loop
'remove message
Please_Wait.Hide
Menu_Print.Hide
End Sub



 
Reply With Quote
 
 
 
 
crferguson@gmail.com
Guest
Posts: n/a
 
      31st Mar 2008
On Mar 31, 12:14*pm, Mouimet <Moui...@discussions.microsoft.com>
wrote:
> HI,
> When I type a associate number the in cell C7 another sheet retrieve all
> info and I print this info. I have many associate number and I do not wantto
> type one by one and print one by one.
> I need a macro to do all numbers at once.
> The data are in Column B starting at B11
> The paste is always at C7.
>
> Example: Copy B11 to C7, do the print and return back to B12. Do copy and
> paste to C7, print and go back to b13, etc.
> Here the VB. The only problem is to go back one row under the last copy.
> Print is ok.
> =========================================
> Sub doUntil9999999()
> 'Message wait please
> Please_Wait.Show False
>
> ' Start selecting associate number
> ' Start at B11 copy, go to C7 paste value, Print then go to the other
> associate
> ' number if it's not 9999999, Starting at b10 to B400.
> ' Need to go down 1 row at a time column B and copy each time in Cell C7
> this new associate number.
> ' My problem is after printing the first associate (B11) I can not return
> from C7 to the other row
>
> Range("B11").Select
> Do Until ActiveCell.Value = 9999999
>
> ActiveCell.Select
> Selection.Copy
> Range("C7").Select
> Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
> * * * * :=False, Transpose:=False
>
> *' trouble here How to go back to the last cell
> *' The function below go under C7
> *' not after the last associate number B11,b12,b13, etc.
>
> ActiveCell.Offset(1, 0).Select
>
> ' Printing here is ok
> Application.ScreenUpdating = False
> * * Sheets("Calendrier").Select
> * * ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
> * * Sheets("Liste").Select
> * * Application.ScreenUpdating = True
> Loop
> 'remove message
> Please_Wait.Hide
> Menu_Print.Hide
> End Sub


Try this modified code here:

Sub doUntil9999999()
dim sCell as String 'added this line

'Message wait please
Please_Wait.Show False


' Start selecting associate number
' Start at B11 copy, go to C7 paste value, Print then go to the other
associate
' number if it's not 9999999, Starting at b10 to B400.
' Need to go down 1 row at a time column B and copy each time in Cell
C7
this new associate number.
' My problem is after printing the first associate (B11) I can not
return
from C7 to the other row


Range("B11").Select
sCell = ActiveCell.Address 'added this line

Do Until ActiveCell.Value = 9999999

Range(sCell).Select 'changed this line
Selection.Copy
Range("C7").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range(sCell).Select 'added this line


' trouble here How to go back to the last cell
' The function below go under C7
' not after the last associate number B11,b12,b13, etc.


ActiveCell.Offset(1, 0).Select
sCell = ActiveCell.Address 'added this line

' Printing here is ok
Application.ScreenUpdating = False
Sheets("Calendrier").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Liste").Select
Application.ScreenUpdating = True
Loop
'remove message
Please_Wait.Hide
Menu_Print.Hide
End Sub
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem after problem after problem - winXP wont start! =?Utf-8?B?TWF2aXJpY2s=?= Windows XP Help 2 23rd Apr 2006 02:55 PM
Microsoft Access Object Library Version Problem (Form VBA Code Problem) Don Microsoft Access Form Coding 2 8th Mar 2004 01:00 PM
hibernation problem! problem!, Power Option problem! Farzad Hayati Microsoft Windows 2000 Hardware 2 5th Feb 2004 10:22 PM
hibernation problem! problem!, Power Option problem! Farzad Hayati Microsoft Windows 2000 Advanced Server 2 5th Feb 2004 10:22 PM
Outlook 2002 connector: problem connecting with Domino server because of NAMELookup2 problem Jean-Paul Smeets Microsoft Outlook 2 26th Sep 2003 10:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:43 PM.