I posted this in reply to a thread, but I think I should have opened a new thread here to get more exposure.
Can I get some help with a formula ? I am very new to Macros.. like 1 day new.
I worked on this all day yesterday at work. It's a two part process. additionally, i'd like to wrap this in a loop, so if it's shorter than 500 rows (as I mention a few lines down, this is what I set it to) it will stop.. and if the file is larger than 500 rows i will process the entire file.
Sheet 1 has 3 columns. An account ID in col A. Amount to be paid in column B, and the name of the Payee in column C.
I need it to work for 500 rows of data. (EDIT: if this was encapsulated in a loop that would be amazing)
right now i can do this process manually, if I copy/paste formulas and copy down.. but can't get it recorded in a macro.
i am copying/pasting the forumulas in the cells while recording the macro. that doesn't seem to always work.
on column D, I have it to copy the amount from B and remove '$' and '.' while retaining any trailing zeros.. i.e. $1745.50 in column B shows as 174550 in column D. The formula I'm using works..
Sheet2
uses this formula (which I put together from hacking up a few different things).
this formula also works for my needs.
the problem I'm having is that my MACRO always works differently. It seems to be using info from my clipboard. Like I said, I'm new to this so it's a steep learning curve right now.
my expected output is a text file with format as follows:
(account#)(9spaces)( 16 digits to include paid amount with leading 0's to fill in the 16 character 'payload')(2 digit import code)(name of payee)
a sample output provided below for a sheet with column A=5113020, column B= $1,693.32, col c = PAYEENAMEGOESHERE
when I noticed it was using my clipboard and i looked at this below, there are not any formulas in the Macro.
I would like to insert the above formulas so it works on any pc.
CURRENT MACRO
I'd like to insert the actual formulas I provided above.
can you assist to convert it and maybe even clue me into where it goes on this script/macro?
I promise when I achieve hero status to mention this website!
PS> I've tried to start on my own, and I'm getting an error right off the bat at the first 'formula' command.
This is totally hacked up, i'm just getting desperate.
thanks in advance for any time spent looking into this.
Can I get some help with a formula ? I am very new to Macros.. like 1 day new.
I worked on this all day yesterday at work. It's a two part process. additionally, i'd like to wrap this in a loop, so if it's shorter than 500 rows (as I mention a few lines down, this is what I set it to) it will stop.. and if the file is larger than 500 rows i will process the entire file.
Sheet 1 has 3 columns. An account ID in col A. Amount to be paid in column B, and the name of the Payee in column C.
I need it to work for 500 rows of data. (EDIT: if this was encapsulated in a loop that would be amazing)
right now i can do this process manually, if I copy/paste formulas and copy down.. but can't get it recorded in a macro.
i am copying/pasting the forumulas in the cells while recording the macro. that doesn't seem to always work.
on column D, I have it to copy the amount from B and remove '$' and '.' while retaining any trailing zeros.. i.e. $1745.50 in column B shows as 174550 in column D. The formula I'm using works..
Code:
=SUBSTITUTE(TEXT(B1,"0.00"),".","")
Sheet2
uses this formula (which I put together from hacking up a few different things).
Code:
=Sheet1!A1&" "&REPT(0,16-LEN(Sheet1!D1))&FIXED(Sheet1!D1,0,1)&"EC"&Sheet1!C1
the problem I'm having is that my MACRO always works differently. It seems to be using info from my clipboard. Like I said, I'm new to this so it's a steep learning curve right now.
my expected output is a text file with format as follows:
(account#)(9spaces)( 16 digits to include paid amount with leading 0's to fill in the 16 character 'payload')(2 digit import code)(name of payee)
a sample output provided below for a sheet with column A=5113020, column B= $1,693.32, col c = PAYEENAMEGOESHERE
Code:
5113020 0000000000169332WIPAYEENAMEGOESHERE
when I noticed it was using my clipboard and i looked at this below, there are not any formulas in the Macro.
I would like to insert the above formulas so it works on any pc.
CURRENT MACRO
Code:
Sub SimpleConverterXL2TXT()
'
' SimpleConverterXL2TXT Macro
' testing
'
'
ActiveSheet.Paste
Range("D2").Select
Sheets("Sheet2").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("D1").Select
Selection.AutoFill Destination:=Range("D1:D500"), Type:=xlFillDefault
Range("D1:D500").Select
Sheets("Sheet2").Select
Selection.AutoFill Destination:=Range("A1:A500"), Type:=xlFillDefault
Range("A1:A500").Select
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\myusernamegoeshere\Desktop\BatchProcessImportfile.txt", FileFormat:= _
xlTextMSDOS, CreateBackup:=False
End Sub
I'd like to insert the actual formulas I provided above.
can you assist to convert it and maybe even clue me into where it goes on this script/macro?
I promise when I achieve hero status to mention this website!
PS> I've tried to start on my own, and I'm getting an error right off the bat at the first 'formula' command.
This is totally hacked up, i'm just getting desperate.
Code:
Sheets("Sheet1").Select
Range("D1").Formula "=SUBSTITUTE(TEXT(B1,""0.00""),""."","""")"
Sheets("Sheet2").Select
Range("A1").Formula "=Sheet1!A1&"" ""&REPT(0,16-LEN(Sheet1!D1))&FIXED(Sheet1!D1,0,1)&""EC""&Sheet1!C1"
thanks in advance for any time spent looking into this.