Excel VBA Copy Row Other Sheet

Excel VBA Copy Row Based On Cell Value And Paste To Other Sheet


       When the "X" value is entered in any cell in column E, the row containing the cell is copied and pasted automatically on the other sheet.


       While copying the row to another sheet, the first blank cell is selected in Sheet2 column A and the data is copied there this VBA codes :
evn.Copy Sheets("Sheet2").Range("A" & Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row + 1)

After the row is copied to the other sheet, it is deleted from Sheet1 :
Target.EntireRow.Delete

Background of the row that it is selected for to copy  is changed as yellow color :
If Target.Column = 5 Then
Set satir = Range(Cells(Target.Row, "A"), Cells(Target.Row, "E"))
satir.Interior.ColorIndex = 6
...


Read more ...

Grand Total Macro

Excel Grand Total Macro
             There are three buttons on this template :
-Add Row
-Delete Row
-Reset

            After entering product informations (name, quantity, price)  ,the "Add Row" button is pressed. The amount calculated by multiplying  price of the product and product units. 
When you add each new product, rows added and grand total is taken.



Read more ...

Find In Column A & Enter Data

Find Data In Column A and Enter Data To Next Two Cells


           In this study , we created a different userform example.
With the combobox on the userform, data is entered into two cells to the right (cells in column B and column C) of the selected record  from column A .



Read more ...

Excel Column Converting To Rows

The Column Converting To Rows (With VBA Code) 

We split the data in  A column to rows  (each row will have thirty data).




Read more ...

Adding Blank Rows and Columns With VBA Codes

Adding Blank Rows And Columns With VBA Checkbox Control

     

          To insert a checkbox control into Excel worksheet :
☑  On the Developer tab, in the Controls group, Insert is clicked, and Check Box is selected under Form Controls.
  The cell is clicked where you want to insert the checkbox (A1 in this template). 

excel checkbox

          💡 Blank rows and blank columns can be added between the filled rows and columns ,with VBA checkbox controls .
The added rows and columns can be removed with checkbox.

excel vba add row add column

Our VBA codes that allow us to add blank rows under filled rows :
Sub Addrow()
Dim a As Byte
Dim c As Integer
[a1].Select
a = 2
c = 0
While ActiveCell.Value <> ""
c = c + 2
ActiveSheet.Rows(c).Insert Shift:=xlDown
ActiveCell.Offset(a, 0).Select
Wend
Range("A1").Select
End Sub

Our VBA codes that allow us to add new columns next to the columns :
Sub AddCol()
Dim c As Integer
[a1].Select
c = 0
While ActiveCell.Value <> ""
c = c + 2
ActiveSheet.Columns(c).Insert Shift:=xlToRight
ActiveCell.Offset(0, 2).Select
Wend
Range("A1").Select
End Sub



Read more ...

Excel Product Comparison

Excel Product Comparison Macro
           The same products in two pages (A and B pages) are lined up on the report page .So that the characteristics of the products compared.


Read more ...

Excel Split With VBA

Excel Split Cell Based On The Space

Based to spaces, the data in the "D1 cell" is divided  into "A column"  with macro.




Read more ...

Excel Get Data From Another Sheet

         Pull data from one Excel sheet to another automatically - without using vlookup or index,match,validation functions –
Only with simple VBA codes.

When you enter values of Id in the  "GetData sheet's  A column", you can get Id's  row information from the "Data" sheet .



Read more ...

Converting Excel Data To HTML Table

Excel to HTML Macro


           A simple and handful macro to convert your Excel data into a HTML table.
The chosen field or cells are saved as HTML table into browser (Chrome etc.).


View of browser :

        Macro can be operated by pressing the button on sheet. Or the macro named Convert is selected and executed from the Macro window opened by pressing +   keys on keyboard.

VBA codes of Conver Macro :
Sub Convert()
    Dim Dosya, Tag_Ac$, Tag_Kapat$, Cells$, Evn As Range, i%, a%
    Set Evn = Application.Intersect(ActiveSheet.UsedRange, Selection)
    If Evn Is Nothing Then MsgBox "Please Select Area", 16: Exit Sub
    Dosya = Application.GetSaveAsFilename(InitialFileName:="Sample-file.html", _
    fileFilter:="HTML Files(*.html), *.html")
    If Dosya = False Then Exit Sub
    Open Dosya For Output As #1
    Print #1, "<HTML>"
    Print #1, "<TABLE BORDER=1 CELLPADDING=3>"
    For i = 1 To Evn.Rows.Count
        Print #1, "<TR>"
        For a = 1 To Evn.Columns.Count
            Select Case Evn.Cells(i, a).HorizontalAlignment
                Case xlHAlignLeft
                    Tag_Ac = "<TD ALIGN=LEFT>"
                Case xlHAlignCenter
                    Tag_Ac = "<TD ALIGN=CENTER>"
                Case xlHAlignGeneral
                    If IsNumeric(Evn.Cells(i, a)) Then
                      Tag_Ac = "<TD ALIGN=RIGHT>"
                    Else
                      Tag_Ac = "<TD ALIGN=LEFT>"
                    End If
                Case xlHAlignRight
                    Tag_Ac = "<TD ALIGN=RIGHT>"
            End Select
            Tag_Kapat = "</TD>"
            If Evn.Cells(i, a).Font.Bold Then
                Tag_Ac = Tag_Ac & "<B>"
                Tag_Kapat = "</B>" & Tag_Kapat
            End If
            If Evn.Cells(i, a).Font.Italic Then
                Tag_Ac = Tag_Ac & "<I>"
                Tag_Kapat = "</I>" & Tag_Kapat
            End If
            Cells = Evn.Cells(i, a).Text
            Print #1, Tag_Ac & Cells & Tag_Kapat
        Next a
        Print #1, "</TR>"
    Next i
    Print #1, "</TABLE>"
    Print #1, "</HTML>"
    Close #1
    MsgBox Evn.Count & " Cells were exported here :  " & Dosya
End Sub



Read more ...

Copy and Paste From Excel To Word

Copy and Paste From Excel To Word With Macro


For example to copy, we chose the cells between A:1 and G:30 in worksheet  .

copy from excel to word


VBA codes to copy from Excel to Word :
Sub wordeaktar()
Set Word = CreateObject("Word.Application")
Word.Documents.Add
Word.Visible = True
Range("A1:G30").Copy
Word.Selection.PasteExcelTable False, False, False
Application.CutCopyMode = False
End Sub



Read more ...

Filtering On Listbox And Copying Filtered Data

Filtering On Listbox And Copying Filtered Data


          You can filter in for each column with textbox and button. By selecting from the filtered data, you can copy it to other sheet (SelectedData sheet).

You can multi-select (feature of "Select All") to copy.

Code of "Select All" on listbox with checkbox :
Private Sub CheckBox1_Click()
Dim r As Long
If CheckBox1.Value = True Then
ListBox2.MultiSelect = fmMultiSelectMulti
For r = 0 To ListBox2.ListCount - 1
ListBox2.Selected(r) = True
Next r
Else
For r = 0 To ListBox2.ListCount - 1
ListBox2.Selected(r) = False
Next r
End If
End Sub




Read more ...

Excel Image Slide Timed

Excel Image Slider

Before “Name” is defined in sheet.

    =KAYDIR(Resimler!$B$1;1;0;BAĞ_DEĞ_DOLU_SAY(Resimler!$B:$B)-1;1)

Then the time is set in VBA window.

     Now + TimeValue("00:00:01")


Read more ...

Excel Calling Image From Another Sheet With Combobox

Excel VBA Calling Image From Other Sheet


 Let's create picture names and pictures. Let's place picture names and pictures without overflow into the cells .(see “resim” page)

Firstly let us define Name- it is Liste :
  
Liste=OFFSET(resim!$B$1;1;0;COUNTA(resim!$B:$B)-1;1)

Let's use "Liste" name  for data validation in C8 and bottom cells.
Let's create the field names for  to be displayed pictures in each cell . Here ,you can use the field name you want :

Resim1a =OFFSET(resim!$C$2;MATCH(Weather!$C$8;Liste;0)-1;0;1;1)
Resim1p =OFFSET(resim!$C$2;MATCH(Weather!$C$9;Liste;0)-1;0;1;1)
Resim2p =OFFSET(resim!$C$2;MATCH(Weather!$C$11;Liste;0)-1;0;1;1)
Resim2t =OFFSET(resim!$C$2;MATCH(Weather!$C$12;Liste;0)-1;0;1;1)
Resim3t =OFFSET(resim!$C$2;MATCH(Weather!$C$13;Liste;0)-1;0;1;1)
  

Let's copy pictures and place to D8, D9, D10, D11 and  D12  cells.

Let's select D8 cell, later let's write the field name we given to formula bar :

  =Resim1a   


excel get image from other sheet
excel get image other sheet offset formula


Read more ...

Yırtılan Ayakkabı Tamiri

Ayakkabı Tamiri

        Vitrinde bir ayakkabı görürüz , hoşumuza gider ve alırız.Alırken ne kadar dikkat etsek de gözümüzden kaçan ayrıntılar olabiliyor.
Üst ve yan taraflarında kalın dikiş yerleri vardı en son aldığım ayakkabıların.Üstlerine biraz su damlasa hemen içine geçiveriyordu.Ayakkabı tamircisine götürdüğümde ilgilenmedi, deri su çeker )) gibi birkaç bahane sıraladı.
İş  başa düşünce ; ne yapabilirim diye düşündüm.Üst ve yan taraflara yapıştırıcı sürmeliydim ama kalın sürersem yapıştırıcının beyaz renkli lekesi çirkin bir görüntü oluşturucaktı.Şöyle bir çözüm geldi aklıma :

-          Eczaneden ufak bir şırınga aldım.
-          Yapıştırıcıyı az miktarda şırınganın içine doldurdum(yapıştırıcı olarak derby kullandım bally gibi kötü bir şöhreti yok malum).Yapıştırıcı şırınganın içinde kurumadan iğne kısmından akıyor.
-          Şırınga ile ayakkabının üst ve yan dikiş yerlerine ince ince sıktım yapıştırıcıyı.Zaten iğne deliğinden azar azar akıyor.
-          Daha sonra kurumaya bıraktım .Ertesi gün yapıştırdığım yerlerin çok belli olmaması için ayakkabıları boyadım .
-          Denemesini yaptığım da su geçmediğini gördüm.İlk yapıştırmada sonuç alamazsanız ikinci kere aynı şekilde tekrar yapıştırın.

Bazen ayakkabıların altında özellikle sivri bir şeylere bastığınız zaman (çivi,cam vs. gibi ) ufak delikler ,yarıklar oluşabiliyor.Bu delikler derin olursa ayakkabı tabanından su almaya başlar.Bu tür delikler için :

-          Ayakkabının alt tarafına bakarak ,deliğin nerede olduğunu tesbit edin.Uç taraflarda daha çok olur.
-          Daha sonra deliğin üstüne biraz sigara külü dökün.Külün üzerine de japon yapıştırıcını sıkın –ben 502 kullandım-.Hemen kemik gibi sert beyaz bir tabaka oluşuyor.Bu şekilde su geçmesini önleyebilirsiniz.Bu çözümü ayakkabının yanlarında da uygulayabilirsiniz ancak biraz çirkin bir görüntü oluşuyor o yüzden sadece tabanda deneyin derim.

Read more ...

Userform Düşeyara Fonksiyonu

Excel Userform İçinde Düşeyara Fonksiyonu- Vlookup On Userform


         Userform üzerindeki combobox (açılır kutu) kontrolünden seçilen değere göre textboxlara veri getirmek için DÜŞEYARA (vlookup) fonksiyonunu VBA kodlar içinde kullanıyoruz.
Farklı bir userform örneği.


Textbox kontrollerini veri doldurmak için kullandığımız "Get Data" butonu kodları şu şekilde :
Private Sub CommandButton1_Click()
Dim Veri As Worksheet
Set Veri = Worksheets("Sheet1")
On Error Resume Next
TextBox1 = WorksheetFunction.VLookup(ComboBox1, Veri.Range("A2:D65536"), 2, 0)
TextBox2 = WorksheetFunction.VLookup(ComboBox1, Veri.Range("A2:D65536"), 3, 0)
TextBox3 = WorksheetFunction.VLookup(ComboBox1, Veri.Range("A2:D65536"), 4, 0)
End Sub



Read more ...

Excel Userformda Resim Görüntüleme

Excel Userform Üzerinde Resim Görüntüleme


           Örnek bir userform hazırladık. Bu userformda kişilerin resimlerini görebilirsiniz.Combobox dan isimler değiştikçe -eğer kişinin resmi var ise - resimler de değişir.
           Resimler ve excel dosyasını aynı klasör içinde kullandık.Bunun için

goster = ThisWorkbook.Path & "\" & Dosya.Name

kodunu kullandık.Bu şablonda en önemli noktalardan biri de ; resim adları ile B sütunundaki kişilerin adları aynı olması.




Read more ...