LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default multi-function macro possibilities?

Dim v as Variant, res as Variant
Dim i as long, rng as Range, cell as Range

v = Array("Header2","Header7","Header9")
for i = lbound(v) to ubound(v)
set rng = Rows(1).Cells
res = Application.Match(v(i),rng,0)
if not iserror(res) then
columns(res).Delete
end if
Next
res = Application.MAtch("Header3"),Rows(1),0)
if not iserror(res) then
set rng = Range(cells(2,res),Cells(rows.count,res).End(xlup) )
for each cell in res
cell.Value = Left(cell,Len(cell)-3)
Next
End if


If the end is always "-01" then turn on the macro recorder, select the
column, and do Edit=Replace
What: -01
With: <leave blank

then turn off the macro recorder and adapt the recorded code to your base
code.

--
Regards,
Tom Ogilvy



"andysgirl8800" wrote:


Hi all!
I'm new to this forum, but somewhat familiar with VBA in MSAccess97.
What I am hoping to accomplish is to create a macro, to be run with a
button click that will perform the following functions:

1) Delete some unecessary columns from one spreadsheet that will always
have the same column headers in the same format, but updated every day
2) Delete specific data from one column, i.e., fields contain a number
like 415444459-01, I want to delete the -01 part and leave the rest of
the number
3) Export the newly formated data, minus header row, into an existing
table in MSAccess97 (which I may have to do via append query within
Access)

I'm really hoping for some suggestions and/or direction on how to begin
coding this macro. I've been browsing this forum for a few hours now,
and looking through some code, but can't seem to figure out how to
program correctly to do the things I need. Any help would be
tremendously appreciated!

Thanks


--
andysgirl8800
------------------------------------------------------------------------
andysgirl8800's Profile: http://www.excelforum.com/member.php...o&userid=34752
View this thread: http://www.excelforum.com/showthread...hreadid=545141


 
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
Excel/VBA possibilities The Alltime Best Excel Programming 2 April 30th 06 09:18 PM
Thousands of possibilities sharkfoot Excel Discussion (Misc queries) 5 March 27th 06 05:11 AM
Conditional w/ three possibilities MathDoctor Excel Discussion (Misc queries) 4 June 11th 05 03:45 PM
Multi-If function Stefano Excel Worksheet Functions 1 April 2nd 05 11:49 AM
Brackets [] possibilities ? alainB[_17_] Excel Programming 5 May 15th 04 10:50 PM


All times are GMT +1. The time now is 05:31 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"