Boa tarde
Essa macro abaixo seleciona uma determinada aba copia e salva a mesma em .txt, porém copia ela toda (até onde tem formula), e eu quero que copie até onde tem células NÃO vazias. Acredito que a mudança deve ser feita na parte de negrito.
Alguém pode me ajudar?
Sub EXPORTAR()
Application.DisplayAlerts = False
template_file = ActiveWorkbook.FullName
fileSaveName = Application.GetSaveAsFilename( _
InitialFileName:="C:\CTBIL" + _
".txt", _
fileFilter:="Text Files (*.txt), *.txt")
If fileSaveName = False Then
Exit Sub
End If
Dim newBook As Workbook
Dim plan As Worksheet
Set newBook = Workbooks.Add
ThisWorkbook.Worksheets("CTBIL.txt").Copy Before:=newBook.Sheets(1)
For Each plan In newBook.Sheets
If plan.Name <> ActiveSheet.Name Then
newBook.Worksheets(plan.Index).Delete
End If
Next
newBook.SaveAs Filename:= _
fileSaveName, FileFormat:=xlTextWindows, _
CreateBackup:=False
newBook.Close SaveChanges:=True
Set newBook = Nothing
MsgBox "O arquivo foi exportado com sucesso! ", vbInformation, "Exportar arquivos"
End Sub