$$Excel-Macros$$ Re: How do I create a drop down list to select which macro to run

2009-10-31 Thread RolfJ

Let's assume that your 3 macros are located in a standard VBA module
and look like this:

Sub Macro1()
MsgBox (Macro1)
End Sub

Sub Macro2()
MsgBox (Macro2)
End Sub
Sub Macro3()
MsgBox (Macro3)
End Sub

Now insert a UserForm in your VBA project then drop a ListBox (named
ListBox1) onto it. In the code section for this UserForm enter the
following code:

Private Sub ListBox1_Click()
Run (ListBox1.Value)
End Sub

Private Sub UserForm_Initialize()
ListBox1.AddItem (Macro1)
ListBox1.AddItem (Macro2)
ListBox1.AddItem (Macro3)
End Sub

Hope this helped,
Rolf

On Oct 30, 11:24 am, CPGH ch...@vvsii.com wrote:
 I have 3 different macros that work, and as opposed to giving them
 each their own ctrl+ key combinations to run, I'd like to create a
 kind of drop down msgbox or something like that that would list the
 different options available to the user so that they can select the
 appropriate macro to run.

 I'm assuming it needs some kind of listbox or combobox, but I have no
 idea how to do this.

 Any help would be greatly appreciated.

 Thanks,
 Chris
--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Re: Separating 1 Worksheet into Multiple Tabs

2009-10-31 Thread RolfJ

In principle that should be possible, but without knowing how the main
worksheet is structured it is difficult to make any specific
suggestions. It would help if you were to post a sample workbook or
described the structure in some other way.

On Oct 30, 7:13 am, Leo leochar...@gmail.com wrote:
 Hello! noob here :)

 I have a project where I am trying to separate out a huge spreadsheet
 into multiple tabs.
 So, the main worksheet has unique Profile Numbers, and then data
 associated with each profile #.
 Is there an easy way where each new profile # is split into a new tab?

 Please advise  do let me know if I can give any more info that will
 be helpful.

 Thx!
--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Re: Macro required for consolidation

2009-10-31 Thread RolfJ

Place this code into a standard VBA module of your workbook XYZ.xls
and give it a try (you will still need to add a button that invokes
the macro, and I would suggest to let the user decide where to save it
by using the standard File | Save As command) :

Sub ConsolidateFilesIntoMasterWorkbook()

Dim folderName As String

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath  \
.Title = Please selected the folder containing the files you
would like to consolidate.
.Show
If .SelectedItems.Count = 0 Then
Exit Sub
Else
folderName = .SelectedItems(1)
End If
End With

Dim masterWb As Workbook, sourceWb As Workbook
Set masterWb = ActiveWorkbook

Dim fs As Object
Dim objFolder As Object
Dim wbFile As Object

Set fs = CreateObject(Scripting.FileSystemObject)
Set objFolder = fs.GetFolder(folderName)

Application.ScreenUpdating = False

Dim sh As Worksheet
Dim rSource As Range, rTarget As Range

For Each wbFile In objFolder.Files
Set sourceWb = Workbooks.Open(wbFile.Path)
For Each sh In sourceWb.Worksheets
Set rSource = sh.UsedRange.Rows(2: 
sh.UsedRange.Rows.Count)
Set rTarget = masterWb.Sheets(1).Cells(Rows.Count,
1).End(xlUp).Offset(1)
rSource.Copy Destination:=rTarget
Next sh
sourceWb.Close (False)
Next wbFile

Application.ScreenUpdating = True

End Sub

It is IMPORTANT that only the files you want to consolidate are in the
selected folder, and no other files!!!

Hope this helped,
Rolf

On Oct 30, 4:33 am, nitin gupta nitin.aq...@gmail.com wrote:
 Hi All

 I am an excel user with negligible knowledge if VBA codes.
 I want to know if following is possible by any generic macro:

 --My objective is to consolidate few number of files (say 20 files)  where
 data is there in just  two fields i.e Country and Sales in USD.   To
 clarify more: There are 20 files with 2 sheets each and each sheet have 2
 headings Country and Sales in USD with data in it . So in nutshell I
 have 40 sheets in 20 files.
 Now I want alll these data to come in One file (say XYZ.xls) one-by-one, no
 futher formatting is required

 --- Above macro should be in a excel file which should have buttons to ask
 for Location  of Dumps(i.e location of 20 files)  and one more button to ask
 for Location of new file (XYZ). And this macro can be used in any machine/PC

 Any help on this is highly appreciated

 Regards
 Nitin
--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Re: For Excel Book

2009-10-31 Thread RolfJ

John Walkenbach's Excel VBA Programming for Dummies' (this is not
intended as an insult. it's REALLY a great book to get started):
http://spreadsheetpage.com/

Hope this helped,
Rolf

On Oct 29, 10:42 pm, khalid khan khalidkhan...@gmail.com wrote:
 Dear friends

 Please suggest me book for Excel and VBA coding

 thank you in advance

 from
 Khalid khan
--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Re: Macro for providing Multiple Passward in a single worksheet.

2009-10-31 Thread RolfJ

Place this code in the VBA module for the worksheet you would like to
restrict and give it a try (needless to say: for this password
strategy to be bullet-proof you would have to password-protect the VBA
project, so that none uf your users can have access to the passwords):

Const RANGE1_PWD = abc
Const RANGE2_PWD = def
Const RANGE3_PWD = xyz

Const RESTRICTED_RANGE1 = A1:K15
Const RESTRICTED_RANGE2 = C3:D6
Const RESTRICTED_RANGE3 = D5:E8

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Static b_UserPassedAuthentication(2) As Boolean

If Not Intersect(Target, Range(RESTRICTED_RANGE1)) Is Nothing Then
If Not Intersect(Target, Range(RESTRICTED_RANGE2)) Is Nothing
Then
If b_UserPassedAuthentication(1) Then Exit Sub
b_UserPassedAuthentication(1) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE2), RANGE2_PWD)
ElseIf Not Intersect(Target, Range(RESTRICTED_RANGE3)) Is
Nothing Then
If b_UserPassedAuthentication(2) Then Exit Sub
b_UserPassedAuthentication(2) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE3), RANGE3_PWD)
Else
If b_UserPassedAuthentication(0) Then Exit Sub
b_UserPassedAuthentication(0) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE1), RANGE1_PWD)
End If
ElseIf Not Intersect(Target, Range(RESTRICTED_RANGE2)) Is Nothing
Then
If Not Intersect(Target, Range(RESTRICTED_RANGE1)) Is Nothing
Then
If b_UserPassedAuthentication(0) Then Exit Sub
b_UserPassedAuthentication(0) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE1), RANGE1_PWD)
ElseIf Not Intersect(Target, Range(RESTRICTED_RANGE3)) Is
Nothing Then
If b_UserPassedAuthentication(2) Then Exit Sub
b_UserPassedAuthentication(2) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE3), RANGE3_PWD)
Else
If b_UserPassedAuthentication(1) Then Exit Sub
b_UserPassedAuthentication(1) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE2), RANGE2_PWD)
End If
ElseIf Not Intersect(Target, Range(RESTRICTED_RANGE3)) Is Nothing
Then
If Not Intersect(Target, Range(RESTRICTED_RANGE1)) Is Nothing
Then
If b_UserPassedAuthentication(0) Then Exit Sub
b_UserPassedAuthentication(0) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE1), RANGE1_PWD)
ElseIf Not Intersect(Target, Range(RESTRICTED_RANGE2)) Is
Nothing Then
If b_UserPassedAuthentication(1) Then Exit Sub
b_UserPassedAuthentication(1) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE2), RANGE2_PWD)
Else
If b_UserPassedAuthentication(2) Then Exit Sub
b_UserPassedAuthentication(2) = UserAuthenticatedForRange
(Range(RESTRICTED_RANGE3), RANGE3_PWD)
End If
End If
End Sub
Function UserAuthenticatedForRange(r As Range, rPwd As String) As
Boolean
If InputBox(Enter the password required to edit cells in range 
 r.Address) = rPwd Then
UserAuthenticatedForRange = True
Else
MsgBox Incorrect password!, vbExclamation
UserAuthenticatedForRange = False
End If
End Function

This may not be the most elegant code, but it seems to do the job.

Hope this helped,
Rolf

On Oct 30, 3:45 am, DEBASHIS BANERJEE debashis@gmail.com wrote:
 Dear  Friends,

 I need  help in writing  macro to  provide multiple  protection of a  work
 sheet .

 ie   two  or  three  passward  can be provided  in a single  work sheet  and
 every  user  would be  restricted to edit  the area  where  he is not
 permitted to edit .

 kindly  help .

 thanks  and regards .

 debashis.
--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ need macro help

2009-10-31 Thread karthikeyan

hi,
I put a validation in one excel worksheet .This  worksheet doesn't
allow paste values from any worksheet/workbook.
tks
karthik

--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Re: need macro help

2009-10-31 Thread sudhir kumar
*hi dear please send attachement
*
On 10/31/09, karthikeyan karthikeyansankar...@gmail.com wrote:


 hi,
 I put a validation in one excel worksheet .This  worksheet doesn't
 allow paste values from any worksheet/workbook.
 tks
 karthik

 


--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Re: Count Rows Where One Cell Has Value And One Cell Is Blank

2009-10-31 Thread KevinSS

Hi Dinsdale,

Why not use the Count and Counta function, something like:
=COUNT(A$2:A$65552) -COUNT(H$2:H$65552)

depending on the data type of your client number, you may need to use
counta instead of count.

Good Luck,
KevinSS

On Oct 29, 12:04 pm, Dinsdale russ.ha...@gmail.com wrote:
 Hello Everyone,

 I have a question about counting rows in a spread sheet. I thought the
 answer to this would be straight forward but I can't seem to get it to
 work the way I want. I would like to count the rows on a sheet where
 one cell has a value (a client number) and where another cell is blank
 (cancellation date). I've tried about a dozen different iterations of
 the COUNTIFS() function but the only thing I have been able to get to
 work is the following hack:

 =(65551 - COUNTIFS(A$2:A$65552,) ) - (65551 - COUNTIFS(H$2:H
 $65552,))

 *65551 is the number of possible rows  minus the header row.

 So essentially I'm counting the number of rows where there is a client
 number (number of possible client rows minus the number of blank
 rows), and subtracting the number of  cancellation dates (number of
 possible cancellation dates minus the number of blank rows)

 I'm not really comfortable with this. I thought that it should be
 something more like this:
 =COUNTIFS(A$2:A$65552,NOT(), H$2:H$65552,)

 This second formula only returns 0.

 Any help on this would be super.

 Thanks!
 Dinsdale

--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



$$Excel-Macros$$ Need a function or formula

2009-10-31 Thread Pooja Sharma
Hi All,

I need your help in extracting some words (having defined format) from one
cell in another cell. Attached is a sheet where I have mentioned the case
and the solution I require.

Hope you will help me.

Best Regards
Pooja Sharma
***

--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---



Required Solution on the Data.xls
Description: MS-Excel spreadsheet


$$Excel-Macros$$ Need help regarding entering date

2009-10-31 Thread Pooja Sharma
Hi All,

In excel 2003, I want to add time in  HH:MM:SS format and I tried it by
changing the format cell with Time in that format but whenever I use the
shortcut for entering time in the Cells, it doesn't show the change of
seconds. The shortcut I use for Time is Ctrl + Shift + ; keys.
If there is any other possibility then please guide me the way.

-- 
Best Regards
Pooja Sharma

--~--~-~--~~~---~--~~
--
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com

HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~--~~~~--~~--~--~---