Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Anyone??...
Jess wrote: I am having a problem with looping. Basically I am trying to pull one number from a list on a separate tab, put it in a cell in template form and save it and then take the next number in the list and populate it in the same cell in the template. The way I'm doing it, it's saveing a workbook for every number between the first number in my list and the last rather than every number that is populated in the cell... If that makes sence. Can anyone help? (Go easy on my, I'm new) Sheets("Dealer List").Select For n = Range("A2") To Range("A48") Range("D4") = n Sheets("Dealer Profile").Select Sheets("Dealer Profile").Copy Range("C4:H7").Select Range("D4").Activate Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ActiveSheet.Shapes("Button 2").Select Application.CutCopyMode = False Selection.Delete ActiveSheet.Shapes("Button 3").Select Application.CutCopyMode = False Selection.Delete Dim FileN FileN = Range("J1") ChDir "\\Bpfile1\groups\CCC\Public\Dealer Profiles" ActiveWorkbook.SaveAs FileName:= _ FileN, FileFormat:=xlNormal _ , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False ActiveWorkbook.Close Next n |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ok, jess, i'll bite........... :) but keep in mind i'm no guru.
in looking @ your code (i have not tried it out), it seems as though what you want somewhere in there is an "if" statement. that way it won't do it for every number, only if the number exists. so first you have to figure out what you want: if "dealername" appears in the list on "dealerlist", then do your stuff. else do other stuff end if does this help? i'd help you write it, but as i said i'm no guru & it'd take me two hours to write it & test it, plus the time it'd take me to research stuff in the newsgroup. :) susan Jess wrote: Anyone??... Jess wrote: I am having a problem with looping. Basically I am trying to pull one number from a list on a separate tab, put it in a cell in template form and save it and then take the next number in the list and populate it in the same cell in the template. The way I'm doing it, it's saveing a workbook for every number between the first number in my list and the last rather than every number that is populated in the cell... If that makes sence. Can anyone help? (Go easy on my, I'm new) Sheets("Dealer List").Select For n = Range("A2") To Range("A48") Range("D4") = n Sheets("Dealer Profile").Select Sheets("Dealer Profile").Copy Range("C4:H7").Select Range("D4").Activate Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ActiveSheet.Shapes("Button 2").Select Application.CutCopyMode = False Selection.Delete ActiveSheet.Shapes("Button 3").Select Application.CutCopyMode = False Selection.Delete Dim FileN FileN = Range("J1") ChDir "\\Bpfile1\groups\CCC\Public\Dealer Profiles" ActiveWorkbook.SaveAs FileName:= _ FileN, FileFormat:=xlNormal _ , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False ActiveWorkbook.Close Next n |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Static variables | Excel Programming | |||
Initializing static variables in VBA | Excel Programming | |||
Static Variables | Excel Programming | |||
Static variables | Excel Programming | |||
Static variables | Excel Programming |