Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text formatting macro help? probably simple!!

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hey all i need some help and dunno vbscript - just an inkling that this can be done easily though...

i have a bunch of data in excel, and i would like to preceed the data in each cell with the "\" character. i am poking around vbscript sites now trying to learn how to do it but no success yet, little help guys? :)

-mike
[NIU] Computer Gaming League
 
If u are using from ASP/HTML use like this

<%@ Language=VBScript %>
<%
response.ContentType = &quot;application/vnd.ms-excel&quot;
%>
<table>
<tr>
<td>\data1 </td>
<td> <%=NOW()%></td>
</tr>
<tr>
<td>\data2 </td>
<td> <%=NOW()%></td>
</tr>
</table>

it will generate an excel table on the IE interface... ________

George
 
thnx, i actually needed it just be done IN excel, what i ended up doing was this:

'Mike Taveirne, 7/23/2001
'because fields (all or some) do not accept pastes, data will be entered though simulated
'keystrokes; this macro prepends a \ for dataloader to each cell with data in it for
'columns A-AZ and rows specified (currently 1-20)

Sub prepend()

Dim cellName As String
Dim col As Integer
Dim row As Integer
Dim tempValue As String

For col = 0 To 25
For row = 1 To 20 'CHANGE row numbers to get all records. this gets columns A-Z
cellName = Chr(col + Asc(&quot;A&quot;))
cellName = cellName + CStr(row)
Range(cellName).Select
tempValue = ActiveCell.Value

if tempValue <> &quot;&quot; then
ActiveCell.Value = &quot;\&quot; & ActiveCell.Value
end if

Next row
Next col

For col = 0 To 25
For row = 1 To 20 'CHANGE row numbers to get all records. this gets columns AA-AZ
cellName = &quot;A&quot; & Chr(col + Asc(&quot;A&quot;))
cellName = cellName + CStr(row)
Range(cellName).Select
tempValue = ActiveCell.Value

if tempValue <> &quot;&quot; then
ActiveCell.Value = &quot;\&quot; & ActiveCell.Value
end if

Next row
Next col

End Sub
 
yes... ms macros in i believe all their products are vbscripts. it's also what many viruses/worms/whatever are written in (such as melissa...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top