LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Non Static Variables in a For...Next Loop

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

 
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
Static variables Derick Hughes Excel Programming 2 June 20th 05 04:10 PM
Initializing static variables in VBA Adrian[_7_] Excel Programming 3 September 3rd 04 01:08 AM
Static Variables Man from Utopia Excel Programming 3 August 8th 04 11:40 PM
Static variables lynnnow[_3_] Excel Programming 3 August 6th 04 07:31 AM
Static variables lynnnow Excel Programming 0 August 6th 04 01:07 AM


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