I am new to VBA and am stuck



  • 1. how do i send email from a macro
    Ok, So I have part of my macro, and I need for it to create a new emai being sent to me when the tab is clicked. I don't want it to send i to me automatically. It's going to be a Comment/Suggestion email tha I need to implement on my userform. I've tried everything I can fin here and several other websites, but it all pertains to sendin workbooks/sheets automatically. Not the way I need it
  • 2. generating random cash flow with same IRR
    Hi all is there a way i can ask excel to change the amounts received in several years, but keeping the IRR always the same? is a variation of Goal seek i imagine. More in general, can Excel generate several numbers keeping the Sum constant? thanks
  • 3. Add VBA code to multiple WorkSheets
    The following code works for one worksheet but when I try to use it for multiple worksheets, I get the error message: Excel has created errors, Windows will shut the program down. A log file has been created. Must I do something special when adding code to multiple worksheets? Thanks in advance. Sub addvba() Dim s As String Dim DEPT2 As String Dim dept As Integer Application.ScreenUpdating = False For dept = 9 To 10 Select Case dept Case 9 DEPT2 = "ALL" Case 10 DEPT2 = "OTHER" End Select Call addactivate(DEPT2) Next dept End Sub Sub addactivate(DEPT2 As String) Dim StartLine As Long Dim s As String Dim LINENUM As Integer s = ActiveWorkbook.Worksheets(DEPT2).CodeName With ActiveWorkbook.VBProject.VBComponents(s).CodeModule StartLine = .CreateEventProc("Activate", "Worksheet") LINENUM = .CountOfLines Debug.Print LINENUM .InsertLines LINENUM - 1, _ "If lastAddress <> """" Then Range(lastAddress).Select" & Chr(13) LINENUM = 6 .InsertLines LINENUM, _ "Private Sub Worksheet_SelectionChange(ByVal Target As Range)" & Chr(13) & _ "lastAddress = Target.Address" & Chr(13) & _ "End Sub" End With End Sub
  • 4. excel 5 dialog sheets
    A long time ago I wrote an application in excel that used dialog sheets as entry forms. Now for the life of me I can't remember how to do this. I would use the generic data entry form but I would like to make some nicer controls and some lists. Does anyone know how to do a custom form for data entry in newer excel versions? or old ones for that matter?

I am new to VBA and am stuck

Postby djsmithuk123 » Sat, 13 Dec 2003 21:01:12 GMT

I am really stuck, plz help me

on my first sheet I have headers called, meeting, time, date, winner.

i have a vba user sheet to input data on the next available line.

this is where I am stuck,

I now need the data enterd to be sorted in the relevant sheets.
for example under the header meeting, i may have 1, 2, 3, 4, 5

what i need is for this data to be sent to other sheets automatically
depending on what meeting it was.

I also need the  remaining data (time, date) to be shown on the
relevant sheet,


sheet 2

should show 
meeting    time    date
1               9:15    20/12/03
1              10:00   20/12/03

should show
meeting   time  date
2              9:20  19/05/03
2             10:45  21/05/03
2             3:15    21/05/03

and so on and so on.

I also need this data to be sorted in order as shown above.
but sheet 1 may not be in sorted order,

is this posable??

if so I would be very gratefull if someone could tell me how to do

many thanx 

Message posted from  http://www.**--****.com/ 

Re: I am new to VBA and am stuck

Postby Tom Ogilvy » Sat, 13 Dec 2003 21:40:46 GMT

You can use the advanced filter to copy date meeting specified criteria from
one sheet to another sheet.   Turn on the macro recorder, then apply and
advanced filter to you data, use the copy option rather the filter in place
option. It is easiest to have the destination be on the same sheet,
otherwise, you have to start the filtering process from the destination
sheet.   Anyway, once you have gotten a copy of the data for one of the
meetings, turn off the macro recorder.  As far as the advanced filter part,
you should have recorded a single command.  You can now alter this command
to put data on another sheet and to reference a separate criteria range on
each of the destination sheets that will get the appropriate data.   If you
want a subset of the columns, this is supported as well.  You can then
record sorting the data on one of the sheets and modify that code also.

Tom Ogilvy

Re: I am new to VBA and am stuck

Postby snoopy369 » Sat, 13 Dec 2003 23:13:01 GMT

Sounds like you're trying to do something similar to what I'm doing ...
if you're reading this on excelforum.com, browse down to my thread --
I'm creating new worksheets dynamically based on a list of names (or in
this case you're using a list of numbers, but it should be similar). 
This is necessary if you don't know how many meetings there are ahead
of time, and want the worksheet to create them dynamically.  

If you want the original tip that I used to help create that, do a
google search on "excel new worksheet" and there should be an
exceltip.com link there. :)


Message posted from  http://www.**--****.com/ 

Similar Threads:

1.Mail Merge application - I am Stuck and need help

Hi to all, 

    I am new in this newsgroup and new to .NET also. I am creating an 
application where I have to perform Mail Merge from my program. I have 
created a form which contain RTB and user can write letters. I 
programmatically add tags for address, name, comp. name et while saving the 
letter. I have a datasource - in for mof a dataset to whom I have to send the 
    This is where I am stuck. I don't know how to open the selected letter 
and replace the tags and how to do mail merge.

    I am working wiht VB 2005.NET. Please help me out.

    Any advice, guidance, suggestions are appreciated. I am really stuck and 
really need help. I hope for any help line from you. So, if you can, please 
help me accordingly.


2.I am stuck....

Ok This is driving me batty..

Dim aStudentEmail(1000),x, iCounter, iTotal

For iCounter = 1 To iTotal
 if LastClass <> rs("ITIDNM") then
     aStudentEmail(x) = studentEmail
     studentEmail =""
 end if

 studentEmail = studentEmail & trim(rs("ITEMAL")) & ","

response.write x & "-" & aStudentEmail(x) & "-<br>"
LastClass = rs("S.ITIDNM")

when it response.writes out.. I see

and so on

yet when I do this:

response.write x & "-" & aStudentEmail(1) & "-<br>"

I get 

WHAT IS GOING ON ? Why cant I get the value of that arraywhen x is in there ???

3.I am using VBA, how do you test for new record in a form

What should I test my VBA code so that I know the User is working with record 
as New in a Form.  I am using Access 2007 under Windows XP.

I used PrimaryID as an auto generated number, therefore it is Null in the 
begining that is how I know the user is trying to add a new record and not 
editing an existing one.

So I test for IsNull(PrimaryID) which works if the user do not make mistake 
but as the user enter more information made mistakes and need to correct the 
PrimaryID is no longer Null.  So my test passed as if the use is editing the 
existing record when in fact the user is trying to add a new record.

Any help is appreciated.

4.I am new to VBA - Help needed on Macro

Although I consider myself fairly good with Excel (I use 2003) I have
never used VBA.

I want to achieve something and feel a macro is the only way I can
achieve it.

Imagine I have the following in Excel:

1	A	B	C	D
2	test	0
3	abc	0
4	abc123	1
5	something	1
6	text	1
7	hello	0

I want a cell, say, D1, to display the corresponding text in column A
for where it finds the first instance of a '1' in the B column. So it
would find a 1 in B4 and therefore display the text 'abc123' in cell
D1. It would then stop looking and ignore the 1's in B5 and B6.

Any help in this would be greatly appreciated!

Many thanks,
Mat G
Birmingham, UK

5.Tax calculator - I am really stuck!

6. Sorry but i am stuck again

7. Please add this in excel 2007 if not I am stuck with 2003

8. I am stuck

Return to MS EXCEL


Who is online

Users browsing this forum: No registered users and 2 guest