$$Excel-Macros$$ Re: How can a custom function know which cell its in?

2009-07-18 Thread Akhilesh Karna
It is simple. Add this function in your excel workbook.[tools->macro->vba editor: insert->module] Function rowNum(r As Range) As Integer rowNum = r.Row End Function in any cell if you type =rowNum(c5) the result will be 5. Akhilesh Kumar Karna On Sat, Jul 18, 2009 at 6:22 AM, Adrian wrote:

$$Excel-Macros$$ Re: Required help on subtotal function.

2009-07-16 Thread Akhilesh Karna
I would be interested if there is simpler method to perform your task. Meanwhile you can use the following function. ' Function StrSubTotal(r As Range) As String Dim i As Integer i = 1 While r.Cells(i, 1).Height = 0 i = i + 1 Wend

$$Excel-Macros$$ Re: How do you make a definition of a "Long" variable Public so it can be used in another sub()

2009-07-13 Thread Akhilesh Karna
If you call Addval from your CntCell subroutine, the value of Count will be available in CntCell. That is, value of Count will be passed to Addval from the original subroutine. Akhilesh Kumar Karna On Mon, Jul 13, 2009 at 12:37 PM, obahor o wrote: > For instance > > Dim Count As Integer > Sub

$$Excel-Macros$$ Re: Urgent!!!!!!!!!!

2009-07-09 Thread Akhilesh Karna
How about the following =COUNTIF(A1:A8,A6) + COUNTIF(A1:A8,A7) Akhilesh Kumar Karna On Thu, Jul 9, 2009 at 4:35 PM, amresh kumar wrote: > Hi Team, > > i want learn more of countif function. > > example > > City Delhi Mumbai Maharashtra > Delhi Mumbai Delhi Mumbai =COUNTIF(

$$Excel-Macros$$ Re: Execution of command button in specified column

2009-06-25 Thread Akhilesh Karna
You need to change your code. It would be better you send your code, so that a minor modification will be sufficient in stead of writing the whole code for you. Akhilesh Kumar Karna On Thu, Jun 25, 2009 at 4:25 AM, Ankit Mehra wrote: > Hello Group, > > First of all, Thanks a lot for showing yo

$$Excel-Macros$$ Re: creation and execution of the batch file using Excel macros

2009-06-15 Thread Akhilesh Karna
1. Creation of batch file Sub Create_bat() open "c:\path\to\file.bat" for output as #1 ' open the batch file ' Add print codes as required (to be printed to the batch file) e.g, Print #1, "copy " & cells(1,1) & " abc.txt" close #1 ' close the file end sub 2. running the batch

$$Excel-Macros$$ Re: Fwd: plot

2009-06-12 Thread Akhilesh Karna
You need to copy the data to excel. The format of your data is not correct. Like, you will need to change 2.147.523 ---> 2147.523. In excel it is very easy to plot the data. Akhilesh Kumar Karna On Fri, Jun 12, 2009 at 1:04 PM, jenny Hanson wrote: > Dear member, > > I have a question . The qu

$$Excel-Macros$$ Re: Reference a column by variable?

2009-06-10 Thread Akhilesh Karna
Replace the following line in your code Worksheets("Input").Range("source_col:source_col").Copy _ Destination:=Worksheets("Output").Range("dest_col" & 1) with Worksheets("Input").Range(source_col & ":" & source_col).Copy _ Destination:=Worksheets("Output").Range(dest_col & 1) Akhilesh Kumar Ka

$$Excel-Macros$$ Re: Macro Help - Print worksheet loop as one print job

2009-06-10 Thread Akhilesh Karna
was not able to get this to work. I have heard that PDF creator has > hooks in it for this kind of thing, but I have not investigated that > yet. > > On May 21, 11:05 am, Dustin wrote: > > I'll try that out and get back to you. > > > > For this example, creati

$$Excel-Macros$$ Re: Macro Help - Print worksheet loop as one print job

2009-05-21 Thread Akhilesh Karna
> > What I would like to do is to have only ONE print job sent to the > printer, which will result in 11 pages. Does that help? > > Dustin > > On May 12, 2:10 am, Akhilesh Karna wrote: > > Maybe I got it wrong. But if I understand

$$Excel-Macros$$ Re: Macro Help - Print worksheet loop as one print job

2009-05-12 Thread Akhilesh Karna
Maybe I got it wrong. But if I understand correctly, then you can use the following code at the end of the loop ( when your data is being read to the invoice). ActiveWindow.SelectedSheets.PrintOut Copies:=1 Hope you make your problem more clear if the above does not help. Akhilesh Kumar Karn

$$Excel-Macros$$ Re: Run a macro on Enter?

2009-05-08 Thread Akhilesh Karna
'Change as necessary End If End Sub Akhilesh Kumar Karna On Fri, May 8, 2009 at 7:55 PM, Doug wrote: > > Thank you for the response. > > The problem with this code is that the macro run as soon as the cell > is selected. I want the macro to wait until the user presses "Enter

$$Excel-Macros$$ Re: Run a macro on Enter?

2009-05-07 Thread Akhilesh Karna
The following code may be of help: open excel open visual basic editor double click sheet1 (or any other sheet) under microsoft excel objects Add the following code Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Intersect(Range("C:C"), Target) Is Nothing Then 'do noth

$$Excel-Macros$$ Re: loop problem.

2009-05-06 Thread Akhilesh Karna
You can use the following code (slightly changed from original). Sub RedemptionsUSD() Dim ModelCash As Worksheet Dim CashFlow As Worksheet Set ModelCash = Workbooks("Model.xls").Worksheets(1) Set CashFlow = Workbooks("Model.xls").Worksheets(2) Dim j As Integer Dim c As Int

$$Excel-Macros$$ Re: Tracking inputs in excel

2009-04-27 Thread Akhilesh Karna
Hi, You can find the solution in the attached file. Try putting the values in input-range to see the effect. Hope it helps. Akhilesh Kumar Karna On Tue, Apr 28, 2009 at 12:13 AM, Urrutia wrote: > > Hi all, > > I'm pretty new to this type of coding in vba. > I'm trying to write a code that wor

$$Excel-Macros$$ Re: Customizing footer so page # is on outside

2009-03-23 Thread Akhilesh Karna
Hi, You may not be able to set different footer for each page in Excel (I may be wrong). However, you can print out your document with the conditional placing of footer using the following code. 'Start- Sub setFooter(pageType As String) ' If pageT

$$Excel-Macros$$ Re: about if ...then with iserror

2009-02-08 Thread Akhilesh Karna
Hello, It was nice to know that the code worked. In the code, vlook is just a variant which will store the result of vlookup function. 'on error resume next' causes the vba code to progress to the next line whenever there is an error, without popping up any error message. So, it needs to be used c

$$Excel-Macros$$ Re: Overflow Error From MsgBox

2009-02-05 Thread Akhilesh Karna
Change the first line of the code to -> Dim RowsMoved As Long [Integer -> Long] It will be better if you break the message inside the msgbox to make it readable (sorry for unsolicited suggestion). Regards, Akhilesh Kumar Karna On Thu, Feb 5, 2009 at 12:40 AM, TimoHubbard wrote: > > Can anyone

$$Excel-Macros$$ Re: about if ...then with iserror

2009-02-05 Thread Akhilesh Karna
Hello, You can improve the performance using the following code: '--- Sub write_equal() Sheets("sheet2").Select Range("a2").Select Dim nameArtist As String Dim searchArea As Range Dim vlook Set searchArea = Sheets("sheet1").Range("a2:b100") Do While

$$Excel-Macros$$ Re: Fwd: read dis

2008-12-25 Thread Akhilesh Karna
Let us not forward hoaxes. We can easily find whether a message is hoax. Please refer below: http://www.hoax-slayer.com/nirosha-silva-hoax.shtml --~--~-~--~~~---~--~~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to t

$$Excel-Macros$$ Re: , is to .csv as ____ is to .xls

2008-12-19 Thread Akhilesh Karna
Excel is not a text file. So you can not change a text file to an excel file by simply changing extension or by replacing comma with other characters. You may try to open an excel (.xls) file with a text editor to see its format. Akhilesh Kumar Karna On Fri, Dec 19, 2008 at 6:38 AM, Yonih wrot

$$Excel-Macros$$ Re: macros help needed

2008-12-09 Thread Akhilesh Karna
1. In your worksheet module add the following procedure 'if there is change in the Column-H mailPrice module will be called. Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Range Set r = Intersect(Target, Range("H3:H80")) If r Is Nothing Then Exit Sub If r.Rows.Count >

$$Excel-Macros$$ Re: Tool with HTML Links

2008-12-07 Thread Akhilesh Karna
You can copy paste the following procedure in the worksheet. In the VBA editor (VBA project) double click the relevant sheet and paste the module below. ' Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("A1")).Rows.Count = 1 Th

$$Excel-Macros$$ Re: Excel VBA Vlookup row and column variables

2008-11-21 Thread Akhilesh Karna
In place of: ActiveCell.FormulaR1C1 use: ActiveCell.Formula change other part of formula accordingly. Akhilesh On Fri, Nov 21, 2008 at 8:56 AM, Leigh Williams <[EMAIL PROTECTED]>wrote: > > I am trying to do a vlookup on my Excel spreadsheet using the > following VBA code: > > Dim row As Inte

$$Excel-Macros$$ Re: Move all data to one column

2008-11-20 Thread Akhilesh Karna
You can use the following macro. Note: This macro will move all the data to column-A. ' Sub moveTo1Col() Dim i As Integer, j As Integer i = 2 While Cells(1, i) <> "" Cells(1, i).Select Range(Selection, Selection.End(xlDown)).Se

$$Excel-Macros$$ Re: devide column values into two columns

2008-11-20 Thread Akhilesh Karna
One way to do this is use the following function. '- Function splitText(r As Range, s As String, col As Byte) Dim txt As String Dim c txt = r.Value c = Split(txt, s) splitText = c(col - 1) End Function '-

$$Excel-Macros$$ Re: scheduling with excel

2008-11-09 Thread Akhilesh Karna
It will be much easier if you attach the file itself. Your question is not very clear to me. Akhilesh On Fri, Nov 7, 2008 at 4:16 PM, <[EMAIL PROTECTED]> wrote: > > I want to use excel to schedule services on trucks. > Individual trucks can have services of 6 weeks, 8 weeks or 10 weeks > apart

$$Excel-Macros$$ Re: How can i print a range of worksheets from workbooks in a directory

2008-11-06 Thread Akhilesh Karna
Hi, Your purpose can be achieved by minor improvement in your code. You can replace the following part of first macro. With Workbooks(sCurFile) >.Worksheets(2).PrintOut >.Worksheets(3).PrintOut >.Close SaveChanges:=False >End

$$Excel-Macros$$ Re: Pls help me..

2008-11-05 Thread Akhilesh Karna
Hi, Probably you cannot find any proper formula for your problem. Following function may help you. [tools->Macro->visual basic editor] will get you to macro editor [insert-> module] and copy paste the following function. You need to see how the function is used as formula in the attached file. '--

$$Excel-Macros$$ Re: Number ranges in a cell

2008-10-31 Thread Akhilesh Karna
Your question is not quite clear. Make it more understandable. Akhilesh On Thu, Oct 30, 2008 at 8:28 AM, Amanda <[EMAIL PROTECTED]> wrote: > > I have a spreadsheet I would like to upload with the column in > question - how do I upload it? > > > --~--~-~--~~~---~--~--

$$Excel-Macros$$ Re: Number ranges in a cell

2008-10-29 Thread Akhilesh Karna
You can run the following macro assuming that your texts are in column-A. If it differs, change the program accordingly. Hope it helps. Option Explicit '- Sub txt2arr() 'Assuming that all the texts are in column-A 'This program will fill the subsequent c

$$Excel-Macros$$ Re: Need Help....!

2008-10-10 Thread Akhilesh Karna
Hello, My idea is as follows. (Someone may come with better ideas.) Assuming that you have names in column-A and dates in column-B; 1. First of all create the function (after the instructions) in your VBA module. Maybe copy-pasted. 2. In cell C2 you can write following formula against the dates "=d

$$Excel-Macros$$ Re: Can anyone help me summarise some data?

2008-09-19 Thread Akhilesh Karna
You can use the following function as a solution. There might be better ones. 1. Open VBA editor ; Insert a module and then copy-paste the following code. '- Option Explicit Function lastWord(r As Range, sWord As String) Dim i As Integer, j

$$Excel-Macros$$ Re: Alternative to Activate?

2008-09-11 Thread Akhilesh Karna
At the start of the program use the following code - Application.screenupdating=false - before terminating the program, repeat the above code with 'true' on the right hand side. Akhilesh On Thu, Sep 11, 2008 at 11:45 PM, Lawrence <[EMAIL PROTECTED]> wrote: > > Hi > > At the moment I am

$$Excel-Macros$$ Re: finding the worksheet name from the cell

2008-09-08 Thread Akhilesh Karna
Hi, I think you can use the following VBA macro. '- Sub findVar() Dim i As Byte, n As Byte Dim findVar n = ActiveWorkbook.Sheets.Count Dim var_no As String Dim sh As String 'sheet name where first occurrence is found var_no = Sheets(

$$Excel-Macros$$ Re: Help in "Dim" in Macros

2008-09-04 Thread Akhilesh Karna
Hi, It is good to start programming from the starting point. In most of the programing languages you need to declare variables before writing the codes. In VBA (Excel Macros) 'Dim' is the keyword for declaration of the variables. It is good habit to declare variables in VBA if you want to be a goo

$$Excel-Macros$$ Re: merging to different sheets

2008-09-04 Thread Akhilesh Karna
You can use the following macro if your filenames are really as you said. Further you need to change the path to the file. You need to check the name of sheet also. Hope it helps. '- Sub combineWorkbooks Dim i As Integer Dim j As Integer Dim w1 As

$$Excel-Macros$$ Re: which one is my active sheet?

2008-09-03 Thread Akhilesh Karna
Hi, I think you should use "F8" button to see what happens at each step. Akhilesh On Tue, Sep 2, 2008 at 10:50 PM, c-class <[EMAIL PROTECTED]>wrote: > > Hello, > > I have the following problem: > >Workbooks(datei).Sheets(land).Activate > >Range("A1:Z176").Copy > >

$$Excel-Macros$$ Re: Intersection of 2 lines

2008-09-01 Thread Akhilesh Karna
I can do this. But, I think you should do your homework by yourself. Please try to do once, if you can't then ask for help. Akhilesh On Sun, Aug 31, 2008 at 7:57 AM, <[EMAIL PROTECTED]> wrote: > > Y values - I have y-values in 2 rows of my spreadsheet, say A5:W5 and > A10:W10. > > X values - The