Search:

Type: Posts; User: rlv01; Keyword(s):

Page 1 of 6 1 2 3 4

Search: Search took 0.02 seconds.

  1. Re: Loop through all WorkSheets is not working, code review please.

    I don't see you using the worksheet loop variable "ws" anywhere.


    For each ws in ThisWorkbook.Worksheets
    .
    .
    .
    Next ws

    You should use "ws" inside the loop somewhere or else there is...
  2. Replies
    7
    Views
    149

    Re: Search words in Text file

    FWIW, The code I posted requires the the Microsoft Scripting Runtime library (Tools->Reference, Check "Microsoft Scripting Runtime")
  3. Re: How to delete last occurence of a character in vba

    Function ReplaceLastChar(ByVal S As String, FindChar As String, ReplaceChar As String) As String
    Dim SPos As Long

    SPos = InStrRev(S, FindChar)
    If SPos > 0 Then
    S = Left(S,...
  4. Replies
    7
    Views
    149

    Re: Search words in Text file

    One way



    Sub SimpleSearch()
    Dim myFSO As FileSystemObject
    Dim path As String, fileName As String
    Dim TSO As TextStream
    Dim Txt As String
    Dim SA, VA
  5. Replies
    7
    Views
    210

    Re: Filtering based on arrays

    I may be misunderstanding what you are trying to do, but are you sure that the Col D filter is not working because the range you gave it to filter is only one cell in size...
  6. Replies
    1
    Views
    105

    Re: Where is the Default location for template?

    If you google "excel 2010 template folder" you will get a lot of help on this topic. One such:
    ...
  7. Replies
    1
    Views
    33

    Re: Moving files Macro

    If as you say, the code you posted "works perfectly", then all you should need to do is add a VBA "kill" statement after FileCopy to delete the source file after it is copied.


    '...
  8. Re: VBA - Using InStr to find substring and cut characters into offset cell

    Without it, the Evaluate function cannot access the values in the range and you get an empty results array. Not sure why.
  9. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    Reading the tea leaves, it looks to me that you might be using a form button on your copied worksheet to run the CommandButton1_Click macro. If so you should use an active-X button (a button...
  10. Replies
    10
    Views
    592

    Re: VBA Lookup Values in Another Workbook

    FWIW, I should mention that my post above is to illustrate how VLOOKUP can be used to get all the column data you want. But since you basically do the same search 5 times (for rw = 1 to 5) it can be...
  11. Replies
    10
    Views
    592

    Re: VBA Lookup Values in Another Workbook

    Not tested.



    Sub ProjectLookUp()
    Dim rw As Long, x As Range, ColF As Range, R As Range
    Dim extwbk As Workbook, twb As Workbook

    Set twb = ThisWorkbook
    Set extwbk =...
  12. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    Something is missing. You have posted the subroutine for the button;but what you posted before


    Sheet4.CommandButton1_Click

    is not the button subroutine; but something in another macro that is...
  13. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    Instead of


    Sheet4.CommandButton1_Click

    try


    Me.CommandButton1_Click
  14. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    Dim path As String
    Dim fileName As String
    Dim wb As Workbook, wbs As Workbook

    Set wbs = ThisWorkbook 'source workbook
    Set wb = Workbooks.Add ...
  15. Replies
    4
    Views
    358

    Re: VBA to add a character to a string?

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim S As String

    S = Trim(CStr(Target.Value))

    If Not...
  16. Replies
    4
    Views
    198

    Re: Loop until ActiveCell is a formula

    Using a DO Loop



    Sub DoLoop()
    Dim I As Long

    I = 1
    Do While I <= 100
    With ActiveSheet.Cells(I, 1)
  17. Replies
    4
    Views
    358

    Re: VBA to add a character to a string?

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim S As String

    S = Trim(CStr(Target.Value))
    If Not Application.Intersect(Me.Columns("N:N"), Target)...
  18. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    I don't really know what you mean by the 'first' userform because so far you have only mentioned one userform, not multiple userforms. If the userform you want to move (export/import, whatever)...
  19. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    The other way to code this is to delete all worksheets in the workbook except the one you want to save and then do a .SaveAs to a new workbook. That will preserve the UserForm
  20. Thread: Loop for testing

    by rlv01
    Replies
    16
    Views
    626

    Re: Loop for testing

    Then it sounds like you also have non-numeric data in col J, so add a test for numeric values:



    Sub a()
    Dim i As Long

    With ActiveSheet
    For i = 0 To .UsedRange.Rows.Count -...
  21. Thread: Loop for testing

    by rlv01
    Replies
    16
    Views
    626

    Re: Loop for testing

    Sub a()
    Dim i As Long

    With ActiveSheet
    For i = 0 To .UsedRange.Rows.count - 1
    If .Range("F1").Offset(i).Value >= 200 Then
    ...
  22. Replies
    19
    Views
    893

    Re: VBA export module to new workbook

    If 'ActiveWorkbook' has userforms then those forms are already retained in the new workbook created by 'SaveAs' will have those forms as well, so that implies you are trying to do something different...
  23. Re: VBA Code that opens a PPT file...now need PPT code to return back to the opened Excel file.

    Maybe something like this



    Private Sub ClosePPT()
    Dim PPT As Object, PP As Object

    Set PPT = CreateObject("PowerPoint.Application")
    For Each PP In PPT.presentations
    ...
  24. Re: Why is the macro window opening when I try to pass an array from one sub to another?

    No worries. I've been known to have a few cranky days myself.
  25. Replies
    3
    Views
    333

    Re: VBA delete rows based on cell criteria

    I tried it on a listobject I created and it worked. Generally speaking if If this works (for your orginal code)


    lo.Range.AutoFilter Field:=4, Criteria1:="Product25"

    then this should also work...
Results 1 to 25 of 150
Page 1 of 6 1 2 3 4