![]() |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:29 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com