Vba copy paste macro

batuka

New Member
Joined
Jul 14, 2017
Messages
32
Code:
Sub sumcopy()

'April/2017












Dim first_day, lasy_day, month, year As Integer
Dim mmonth As String
Dim source_file As String








month = InputBox("Please enter the Month", "TCU//QNB Finansbank")
year = Worksheets("Macro").Cells(6, 2)




'Hangi ay hangi sayfada onu buluyoruz.


 If month = 1 Then
            mmonth = "January"
 ElseIf month = 2 Then
            mmonth = "February"
 ElseIf month = 3 Then
            mmonth = "March"
 ElseIf month = 4 Then
            mmonth = "April"
 ElseIf month = 5 Then
            mmonth = "May"
 ElseIf month = 6 Then
            mmonth = "June"
 ElseIf month = 7 Then
            mmonth = "July"
 ElseIf month = 8 Then
            mmonth = "August"
 ElseIf month = 9 Then
            mmonth = "September"
 ElseIf month = 10 Then
            mmonth = "October"
 ElseIf month = 11 Then
            mmonth = "November"
 ElseIf month = 12 Then
            mmonth = "December"
 End If










'target file
target_path = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\Core Pozisyon Aylık Özet"
target_mainfile = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\" & "Core Pozisyon Özet" & ".xlsm"


Dim Column, Column_2 As Integer


wb = ActiveWorkbook.Name




'target file


If aay = "January" Then


Workbooks(wb).Worksheets(1).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2


ElseIf aay = "February" Then


Workbooks(wb).Worksheets(2).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "March" Then


Workbooks(wb).Worksheets(3).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2




ElseIf aay = "April" Then


Workbooks(wb).Worksheets(4).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "May" Then


Workbooks(wb).Worksheets(5).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "June" Then


Workbooks(wb).Worksheets(6).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2




ElseIf aay = "July" Then


Workbooks(wb).Worksheets(7).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2




ElseIf aay = "August" Then


Workbooks(wb).Worksheets(8).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "September" Then


Workbooks(wb).Worksheets(9).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "October" Then


Workbooks(wb).Worksheets(10).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "November" Then


Workbooks(wb).Worksheets(11).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






ElseIf aay = "December" Then


Workbooks(wb).Worksheets(12).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2






End If




j = 2


Do Until ActiveSheet.Cells(3, j) = ""




first_day_date = Cells(3, j)




If Day(first_day_date) <= 9 Then


first_day = "0" & Day(first_day_date)




Else


first_day = Day(first_day_date)


End If


'source file


If month <= 9 Then


source_path = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\(0" & ay & ")_" & aay
source_file = source_path & "\CORE-MİZAN Pozisyon Kontrolü_" & yil & "-0" & ay & "-" & ilk_gun & ".xlsx"
Else
source_path = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\(" & ay & ")_" & aay
source_file = source_path & "\CORE-MİZAN Pozisyon Kontrolü_" & yil & "-" & ay & "-" & ilk_gun & ".xlsx"
End If




'open file


Workbooks.Open (source_file), ReadOnly:=True
wb_core = ActiveWorkbook.Name


'to get daily summary of poz


ActiveWorkbook.Worksheets("summary").Activate
        
            i = 5
            Do Until i = 24
            
            
            If aay = "January" Then
                    
            Workbooks(wb).Worksheets(1).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
                       
            ElseIf aay = "February" Then
            
            Workbooks(wb).Worksheets(2).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
           
            ElseIf aay = "March" Then
            
            Workbooks(wb).Worksheets(3).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
             
            
            ElseIf aay = "April" Then
                       
            
            Workbooks(wb).Worksheets(4).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
             
            ElseIf aay = "May" Then
                       
            Workbooks(wb).Worksheets(5).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
             
            ElseIf aay = "June" Then
            Workbooks(wb).Worksheets(6).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
            ElseIf aay = "July" Then
                        
            Workbooks(wb).Worksheets(7).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
             
            ElseIf aay = "August" Then
            
            Workbooks(wb).Worksheets(8).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
           
            ElseIf aay = "September" Then
            
            Workbooks(wb).Worksheets(9).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            ElseIf aay = "October" Then
            Workbooks(wb).Worksheets(10).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
            ElseIf aay = "November" Then
            
            Workbooks(wb).Worksheets(11).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
           
            ElseIf aay = "December" Then
            Workbooks(wb).Worksheets(Sheet12).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
          
            End If
            
            i = i + 1
                  
            Loop
            
Loop




Workbooks(wb).Save




















End Sub

hi here is my code which i want to do open daily files and copy the exact same place to my main file my main file got the dates on Column like 01/01/2017 it supposed to do when i write the month like 01 open all the 01 daily files and copy the place which i wrote in the code and get them to the main file when i write the month number like 07 it only gets the first day of the month help please thanks
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Not sure if this will help but try incrementing j
Code:
            Loop
      j=j+1      
Loop
 
Upvote 0
Not sure if this will help but try incrementing j
Code:
            Loop
      j=j+1      
Loop

nope still it can open 1st day of the month file and copy paste it to my target file but it can't open other other days i believe if it can open it can copy and paste it
 
Upvote 0
Is the code you supplied the entire code?
Because you are are using variables which have no value, you are also assigning values to variables, but never using them!
 
Upvote 0
Is the code you supplied the entire code?
Because you are are using variables which have no value, you are also assigning values to variables, but never using them!

ohh i think i got where you re confused aay=mmonth i was translating to english in order to getting help from you guys it is my native language if you have any part to ask ask me pls so i can tell what i was trying to do that part probably i did mistakes becouse i am not good at macros yet. thx for help
 
Upvote 0
Could you please re-post your code, without any changes?
 
Upvote 0
Could you please re-post your code, without any changes?

Code:
Sub core_poz_ozet()
 
'Macro by Damla, April/2017
 
 
 
 
 
 
Dim ilk_gun, son_gun, ay, yil As Integer
Dim aay As String
Dim kaynak_dosya As String
 
 
 
'
'gun = Worksheets("Macro").Cells(4, 2)
'ay = Worksheets("Macro").Cells(5, 2)
'yil = Worksheets("Macro").Cells(6, 2)
'aay = Worksheets("Macro").Cells(7, 2)
'tarih = Worksheets("Macro").Cells(1, 5)
't = InputBox("Lütfen tarih giriniz", "TCU // QNB Finansbank", tarih)
 
ay = InputBox("Lütfen Dosyanın Yapılacağı Ayı Sayı ile yazınız", "TCU//QNB Finansbank")
yil = Worksheets("Macro").Cells(6, 2)
 
 
'Hangi ay hangi sayfada onu buluyoruz.
 
If ay = 1 Then
              aay = "Ocak"
ElseIf ay = 2 Then
              aay = "Şubat"
ElseIf ay = 3 Then
              aay = "Mart"
ElseIf ay = 4 Then
              aay = "Nisan"
ElseIf ay = 5 Then
              aay = "Mayıs"
ElseIf ay = 6 Then
              aay = "Haziran"
ElseIf ay = 7 Then
              aay = "Temmuz"
ElseIf ay = 8 Then
              aay = "Ağustos"
ElseIf ay = 9 Then
            aay = "Eylül"
ElseIf ay = 10 Then
            aay = "Ekim"
ElseIf ay = 11 Then
            aay = "Kasım"
ElseIf ay = 12 Then
            aay = "Aralık"
End If
 
 
 
'Sheet1 = Nisan
'Sheet3 = Mart
'Sheet4 = Ocak
'Sheet5 = Şubat
'Sheet6 = Mayıs
'Sheet7 = Haziran
'Sheet8 = Temmuz
'Sheet9 = Ağustos
'Sheet10 = Eylül
'Sheet11 = Ekim
'Sheet12 = Kasım
'Sheet13 = Aralık
 
 
'hedef dosya
hedef_dizin = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\Core Pozisyon Aylık Özet"
hedef_anadosya = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\" & "Core Pozisyon Özet" & ".xlsm"
 
Dim sutun, sutun_2 As Integer
 
wb = ActiveWorkbook.Name
 
 
'hedef dosya sütun saydırma
 
If aay = "Ocak" Then
 
Workbooks(wb).Worksheets(1).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
ElseIf aay = "Şubat" Then
 
Workbooks(wb).Worksheets(2).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Mart" Then
 
Workbooks(wb).Worksheets(3).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
ElseIf aay = "Nisan" Then
 
Workbooks(wb).Worksheets(4).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Mayıs" Then
 
Workbooks(wb).Worksheets(5).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Haziran" Then
 
Workbooks(wb).Worksheets(6).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
ElseIf aay = "Temmuz" Then
 
Workbooks(wb).Worksheets(7).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
ElseIf aay = "Ağustos" Then
 
Workbooks(wb).Worksheets(8).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Eylül" Then
 
Workbooks(wb).Worksheets(9).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Ekim" Then
 
Workbooks(wb).Worksheets(10).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Kasım" Then
 
Workbooks(wb).Worksheets(11).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
ElseIf aay = "Aralık" Then
 
Workbooks(wb).Worksheets(12).Activate
ActiveSheet.Range("a4").Select
Range(Selection, Selection.End(xlToRight)).Select
sutun = Application.Count(Selection) + 2
 
 
 
End If
 
 
j = 2
 
Do Until ActiveSheet.Cells(3, j) = ""
 
 
ilk_gun_tarih = Cells(3, j)
 
 
If Day(ilk_gun_tarih) <= 9 Then
 
ilk_gun = "0" & Day(ilk_gun_tarih)
 
 
Else
 
ilk_gun = Day(ilk_gun_tarih)
 
End If
 
'kaynak dosya
 
If ay <= 9 Then
 
kaynak_dizin = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\(0" & ay & ")_" & aay
kaynak_dosya = kaynak_dizin & "\CORE-MİZAN Pozisyon Kontrolü_" & yil & "-0" & ay & "-" & ilk_gun & ".xlsx"
Else
kaynak_dizin = "G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_" & yil & "\Bilanço_Kontrolleri\Core_Pozisyon\(" & ay & ")_" & aay
kaynak_dosya = kaynak_dizin & "\CORE-MİZAN Pozisyon Kontrolü_" & yil & "-" & ay & "-" & ilk_gun & ".xlsx"
End If
 
 
'pozisyon dosyası açma
 
Workbooks.Open (kaynak_dosya), ReadOnly
wb_core = ActiveWorkbook.Name
 
'Özet total pozisyonu günlük bazda getirmek
 
ActiveWorkbook.Worksheets("summary").Activate
       
            i = 5
            Do Until i = 24
           
            
            If aay = "Ocak" Then
                   
            Workbooks(wb).Worksheets(1).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
           
            
            
            ElseIf aay = "Şubat" Then
           
            Workbooks(wb).Worksheets(2).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
          
            ElseIf aay = "Mart" Then
           
            Workbooks(wb).Worksheets(3).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
            
            ElseIf aay = "Nisan" Then
                      
            
            Workbooks(wb).Worksheets(4).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
            ElseIf aay = "Mayıs" Then
                      
            Workbooks(wb).Worksheets(5).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
            ElseIf aay = "Haziran" Then
            Workbooks(wb).Worksheets(6).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
           
            ElseIf aay = "Temmuz" Then
                       
            Workbooks(wb).Worksheets(7).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            
            ElseIf aay = "Ağustos" Then
           
            Workbooks(wb).Worksheets(8).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
          
            ElseIf aay = "Eylül" Then
           
            Workbooks(wb).Worksheets(9).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
            ElseIf aay = "Ekim" Then
            Workbooks(wb).Worksheets(10).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
           
            ElseIf aay = "Kasım" Then
           
            Workbooks(wb).Worksheets(11).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
          
            ElseIf aay = "Aralık" Then
            Workbooks(wb).Worksheets(Sheet12).Cells(i - 1, j).Value = Workbooks(wb_core).Worksheets("summary").Cells(i, 7).Value
         
            End If
           
            i = i + 1
                 
            Loop
           
Loop
 

 
Workbooks(wb).Save
 
 
 
 
 
 
 
 
 End Sub
 
Upvote 0
In this section you have given the variable sutun a value, but it is never used.
Therefore is it needed?
Code:
    If aay = "Ocak" Then
     
    Workbooks(Wb).Worksheets(1).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Subat" Then
     
    Workbooks(Wb).Worksheets(2).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Mart" Then
     
    Workbooks(Wb).Worksheets(3).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Nisan" Then
     
    Workbooks(Wb).Worksheets(4).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Mayis" Then
     
    Workbooks(Wb).Worksheets(5).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Haziran" Then
     
    Workbooks(Wb).Worksheets(6).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Temmuz" Then
     
    Workbooks(Wb).Worksheets(7).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Agustos" Then
     
    Workbooks(Wb).Worksheets(8).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Eylül" Then
     
    Workbooks(Wb).Worksheets(9).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Ekim" Then
     
    Workbooks(Wb).Worksheets(10).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Kasim" Then
     
    Workbooks(Wb).Worksheets(11).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Aralik" Then
     
    Workbooks(Wb).Worksheets(12).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    End If
 
Upvote 0
In this section you have given the variable sutun a value, but it is never used.
Therefore is it needed?
Code:
    If aay = "Ocak" Then
     
    Workbooks(Wb).Worksheets(1).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Subat" Then
     
    Workbooks(Wb).Worksheets(2).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Mart" Then
     
    Workbooks(Wb).Worksheets(3).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Nisan" Then
     
    Workbooks(Wb).Worksheets(4).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Mayis" Then
     
    Workbooks(Wb).Worksheets(5).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Haziran" Then
     
    Workbooks(Wb).Worksheets(6).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Temmuz" Then
     
    Workbooks(Wb).Worksheets(7).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Agustos" Then
     
    Workbooks(Wb).Worksheets(8).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Eylül" Then
     
    Workbooks(Wb).Worksheets(9).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Ekim" Then
     
    Workbooks(Wb).Worksheets(10).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Kasim" Then
     
    Workbooks(Wb).Worksheets(11).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    ElseIf aay = "Aralik" Then
     
    Workbooks(Wb).Worksheets(12).Activate
    ActiveSheet.Range("a4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    sutun = Application.Count(Selection) + 2
     
    End If

sutun means column i was trying to get the data
 
Upvote 0
If I'm understanding this correctly, for a file created on the 26th July 2017 you'd have a file path & file name like
G:\HOME\MALIKONT\_Hazine_Kontrol\TCU_2017\Bilanço_Kontrolleri\Core_Pozisyon\(07)_July\
CORE-MIZAN Pozisyon Kontrolü_2017-07-26.xlsx
And in row 3 starting in column B you have the dates the files were created.
is this correct?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top