Results 1 to 20 of 20

Macro doesn't correctly replace "." with "," and getting Run-time error '1004'.

Threaded View

  1. #1
    Registered User
    Join Date
    07-05-2018
    Location
    Győr, Hungary
    MS-Off Ver
    MS Office Excel 2010
    Posts
    20

    Macro doesn't correctly replace "." with "," and getting Run-time error '1004'.

    Hello everyone,

    I have to following macro running in the attached workbook "proba2":

    Sub Makró1()
    
    Range("H1").Select
    Selection.EntireRow.Delete
    Columns("H:H").Select
    Selection.TextToColumns Destination:=Range("H1"), DataType:=xlDelimited, _
    TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
    Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
    :="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1)), _
    TrailingMinusNumbers:=True
    Columns("H:K").Select
    Selection.Replace What:=".", Replacement:=",", LookAt:=xlPart, _
    SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
    Columns("K:K").Select
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Range("ActiveSheet!$K:$K")
    End Sub
    First of all, the macro doesn't completely change every "." to "," in the selected range, and also pops up an error message (Run-time error: '1004') referring to the highlighted row of the macro.

    Here's a detailed process, what I want the macro to do:

    1. Delete the first row
    2. Select column H, and divide it to multiple columns using "|" (Alt Gr+W) as a divider.
    3. Select the created columns H-K and swap every "." with ","
    4. Create a bar graph from column K

    Any ideas to make it work?
    Attached Files Attached Files
    Last edited by H.Gabor; 07-26-2018 at 05:50 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 05-02-2018, 08:03 AM
  2. Replies: 35
    Last Post: 01-13-2016, 02:16 AM
  3. Replies: 4
    Last Post: 11-13-2015, 09:03 PM
  4. [SOLVED] VBA help needed to remove all "/" then replace with "-" from cell "B3"and "B5"
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2014, 02:11 PM
  5. get "run time error 1004" when i try to activate macro on protected sheet why?
    By ASAFSWIS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-19-2013, 11:37 AM
  6. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  7. Excel 2007 : Macro gives a "run time error '1004'"
    By grsnipe in forum Excel General
    Replies: 1
    Last Post: 10-15-2010, 02:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1