Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:56:11+00:00 2026-06-15T21:56:11+00:00

I have a little problem with my macrocode, and need your advice. Here my

  • 0

I have a little problem with my macrocode, and need your advice. Here my base macrocode:

Option Explicit

Sub NurZumUeben()

'oberste Zeile löschen, fixieren und linksbündig ausrichten
Rows("1:1").Select
Selection.Delete Shift:=xlUp
With ActiveWindow
   .SplitColumn = 0
   .SplitRow = 1
End With
ActiveWindow.FreezePanes = True

'Jede zweite Zeile schattieren
Application.ScreenUpdating = False
Dim Zeile, ZeilenNr As Integer
With ActiveSheet.UsedRange.Rows
   .Interior.ColorIndex = xlNone
   .Borders.ColorIndex = xlNone
End With
ZeilenNr = 2
For Zeile = 2 To ActiveSheet.UsedRange.Rows.Count
    With Rows(Zeile)
        If .Hidden = False Then
            If ZeilenNr Mod 2 = 0 Then
                .Interior.ColorIndex = 15
                .Borders.Weight = xlThin
                .Borders.ColorIndex = 16
                ZeilenNr = ZeilenNr + 1
            Else
                ZeilenNr = ZeilenNr + 1
            End If
        End If
    End With
Next Zeile
Application.ScreenUpdating = True


'oberste Zeile einfärben
Rows("1:1").Select
With Selection.Interior
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    .Color = 65535
    .TintAndShade = 0
    .PatternTintAndShade = 0
End With




'Spalte_suchen&formatieren
Dim iLeSpa     As Integer
Dim iSpalte    As Integer
Dim bGefunden  As Boolean

iLeSpa = IIf(IsEmpty(Cells(1, Columns.Count)), Cells(1, _
  Columns.Count).End(xlToLeft).Column, Columns.Count)

For iSpalte = 1 To iLeSpa
   If Cells(1, iSpalte).Value = "click_thru_pct" Then
     bGefunden = True
     Exit For
  End If
Next iSpalte

If bGefunden Then
  With Range(Cells(2, iSpalte), Cells(5000, iSpalte))
     .Replace What:="%", Replacement:="", LookAt:=xlPart, SearchOrder:=xlByRows
     Range("K1") = 100
     Range("K1").Copy
     .PasteSpecial Paste:=xlPasteAll, Operation:=xlDivide
     .NumberFormat = "0.00%"
     Range("K1").Clear
  End With
Else
  MsgBox "Die Überschrift  ""click_thru_pct""  wurde nicht gefunden.", _
     48, "   Hinweis für " & Application.UserName
End If

End Sub

Once thank you all who can help. Unfortunately, I get the final formatting not go quite

Here are the results: example

I did not want to color the entire column but only the top row. In addition, the lower empty fields with ugly 0.00% formatted constantly.

Furthermore, I noticed that after the coloration of the first line, the field K1 is visible. That is with me unfortunately impractical because these Excel documents can also go differently in the row.

Here is the document on which you can test it if necessary.
example

Thank you very much

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:56:13+00:00Added an answer on June 15, 2026 at 9:56 pm

    Change modular function to calculate the for loop variable. I see no purpose in using a separate variable for this. Change this:

    ZeilenNr = 2
        For Zeile = 2 To ActiveSheet.UsedRange.Rows.Count
            With Rows(Zeile)
                If .Hidden = False Then
                    If ZeilenNr Mod 2 = 0 Then
                        .Interior.ColorIndex = 15
                        .Borders.Weight = xlThin
                        .Borders.ColorIndex = 16
                        ZeilenNr = ZeilenNr + 1
                    Else
                        ZeilenNr = ZeilenNr + 1
                    End If
                End If
            End With
        Next Zeile
    

    To this:

        For Zeile = 2 To ActiveSheet.UsedRange.Rows.Count
            With Rows(Zeile)
                If .Hidden = False Then
                    If Zeile Mod 2 = 0 Then
                        .Interior.ColorIndex = 15
                        .Borders.Weight = xlThin
                        .Borders.ColorIndex = 16
                    End If
                End If
            End With
        Next Zeile
    

    I apologize if I am missing something here. Also, I cannot view the examples you provided because the site requires a login and it is not in English. Sorry again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have little unusual problem to solve. I need some hint or links to
I have a little problem with Jquery getJSON function. my json here { entries:
I have one little problem...Here is my code..Is there a way to distribute weights
I have a little problem, with Android application: I need to take a picture,
i have a little problem here. I am working on a little application wich
I have little problem on the here http//site.com/detial.php?verifyID=$parametre i want this like short url
I have little problem with form and I am using js for validation. Here
I have little problem with my script. Here is the code. http://pastie.org/2361140 When I
have a little problem here: int IntegerTransformer::transformFrom(std::string string){ stream->clear(); std::cout<<string<<std::endl;; (*stream)<<string; int i; (*stream)>>i;
I have little problem with mysql query. I need something like GROUP_CONCAT in GROUP_CONCAT.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.