Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Select and Save as

Hi all

Can anyone help me with some code please

My data is in A1 to J1100
in column B there are random sequences of number

1
2
3
4
1
2
3
4
5
1
2
3
1
2
3
4
5
6

How can I select in column B the sequence 1 to 4 , then highlight B1 to J4
and save as a html file to c:\
With the file name always to the left of the 1, A1. A5, A10 etc, and when
the code finishes goto B5 and start the code again.

Thanks in advance

Dave


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Select and Save as

Something like (totally untested, just to start you off):

Dim i As Long
For i = 1 To 1097 Step 4
Set wb = Workbooks.Add
Set ws = wb.ActiveSheet
ThisWorkbook.ActiveSheet.Cells(i, 2).Resize(, 9).Copy ws.Cells(1, 1)
wb.SaveAs Cells(i, 1), xlHtml
wb.Close False
Next

__________________________________________________ ________________________


"DaveM" wrote in message
. uk...
Hi all

Can anyone help me with some code please

My data is in A1 to J1100
in column B there are random sequences of number

1
2
3
4
1
2
3
4
5
1
2
3
1
2
3
4
5
6

How can I select in column B the sequence 1 to 4 , then highlight B1 to
J4
and save as a html file to c:\
With the file name always to the left of the 1, A1. A5, A10 etc, and when
the code finishes goto B5 and start the code again.

Thanks in advance

Dave



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Select and Save as

Thanks for your help

run-time error 1004

in debug below was highlighted yellow

wb.SaveAs Cells(i, 1), xlHtml

a new workbook was created with data from another location than selected.



"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
Something like (totally untested, just to start you off):

Dim i As Long
For i = 1 To 1097 Step 4
Set wb = Workbooks.Add
Set ws = wb.ActiveSheet
ThisWorkbook.ActiveSheet.Cells(i, 2).Resize(, 9).Copy ws.Cells(1, 1)
wb.SaveAs Cells(i, 1), xlHtml
wb.Close False
Next

__________________________________________________ ________________________


"DaveM" wrote in message
. uk...
Hi all

Can anyone help me with some code please

My data is in A1 to J1100
in column B there are random sequences of number

1
2
3
4
1
2
3
4
5
1
2
3
1
2
3
4
5
6

How can I select in column B the sequence 1 to 4 , then highlight B1 to
J4
and save as a html file to c:\
With the file name always to the left of the 1, A1. A5, A10 etc, and when
the code finishes goto B5 and start the code again.

Thanks in advance

Dave





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default Select and Save as

Does column A contain the fully-qualified filename that you want to save the
file as? With the full path?
__________________________________________________ ______________________

"DaveM" wrote in message
...
Thanks for your help

run-time error 1004

in debug below was highlighted yellow

wb.SaveAs Cells(i, 1), xlHtml

a new workbook was created with data from another location than selected.



"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
Something like (totally untested, just to start you off):

Dim i As Long
For i = 1 To 1097 Step 4
Set wb = Workbooks.Add
Set ws = wb.ActiveSheet
ThisWorkbook.ActiveSheet.Cells(i, 2).Resize(, 9).Copy ws.Cells(1, 1)
wb.SaveAs Cells(i, 1), xlHtml
wb.Close False
Next

__________________________________________________ ________________________


"DaveM" wrote in message
. uk...
Hi all

Can anyone help me with some code please

My data is in A1 to J1100
in column B there are random sequences of number

1
2
3
4
1
2
3
4
5
1
2
3
1
2
3
4
5
6

How can I select in column B the sequence 1 to 4 , then highlight B1 to
J4
and save as a html file to c:\
With the file name always to the left of the 1, A1. A5, A10 etc, and
when
the code finishes goto B5 and start the code again.

Thanks in advance

Dave







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Select and Save as

All OK Thanks Vasant


"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
Does column A contain the fully-qualified filename that you want to save
the file as? With the full path?
__________________________________________________ ______________________

"DaveM" wrote in message
...
Thanks for your help

run-time error 1004

in debug below was highlighted yellow

wb.SaveAs Cells(i, 1), xlHtml

a new workbook was created with data from another location than selected.



"Vasant Nanavati" <vasantn AT aol DOT com wrote in message
...
Something like (totally untested, just to start you off):

Dim i As Long
For i = 1 To 1097 Step 4
Set wb = Workbooks.Add
Set ws = wb.ActiveSheet
ThisWorkbook.ActiveSheet.Cells(i, 2).Resize(, 9).Copy ws.Cells(1, 1)
wb.SaveAs Cells(i, 1), xlHtml
wb.Close False
Next

__________________________________________________ ________________________


"DaveM" wrote in message
. uk...
Hi all

Can anyone help me with some code please

My data is in A1 to J1100
in column B there are random sequences of number

1
2
3
4
1
2
3
4
5
1
2
3
1
2
3
4
5
6

How can I select in column B the sequence 1 to 4 , then highlight B1
to J4
and save as a html file to c:\
With the file name always to the left of the 1, A1. A5, A10 etc, and
when
the code finishes goto B5 and start the code again.

Thanks in advance

Dave











Reply
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
Where does Excel2007 save files -- not where I select? Dick Excel Worksheet Functions 1 October 16th 09 03:13 AM
Help with, Select then Save as DaveM[_2_] Excel Programming 0 July 12th 07 08:49 PM
Code for Select a file and save it in a different location Oggy Excel Programming 2 April 22nd 07 03:58 PM
User select Save To Folder Brad Excel Programming 4 November 16th 06 09:06 PM
Save RAND select number RC Excel Discussion (Misc queries) 3 November 9th 06 11:10 PM


All times are GMT +1. The time now is 03:48 PM.

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"