+ Reply to Thread
Results 1 to 3 of 3

Excel 2008 : Select arange value in for each loop

  1. #1
    Registered User
    Join Date
    07-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    2

    Select arange value in for each loop

    Hi.
    i got this code:
    PHP Code: 
    Sub A()
     
    Dim ws As Worksheet
     Dim Ccell 
    As Range
     Set Ccell 
    Application.InputBox("בחר תא אותו תרצה להעתיק בכל הגליונות:""בחירת תא""A1"Type:=8)
       For 
    Each ws In ActiveWorkbook.Worksheets
          
    If ws.Name <> "1" Then
              ws
    .Activate
              Ccell
    .Select
              Selection
    .Copy
              Sheet1
    .Select
              ActiveCell
    .Offset(10).PasteSpecial
          End 
    If
       
    Next ws
    End Sub 
    the VB debug me at "Ccell.Select". i just need to select it from ther i can get it on.

    thx :]

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Select arange value in for each loop

    I would do it this way, store the range "address" as a string, then copy that range from each ws using this syntax:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    07-21-2012
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Select arange value in for each loop

    i change it to:
    PHP Code: 
    Sub A()
    Dim ws As WorksheetCcell As String

    Ccell 
    Application.InputBox("בחר תא אותו תרצה להעתיק בכל הגליונות:""בחירת תא""A1"Type:=8).Address

        
    For Each ws In ActiveWorkbook.Worksheets
            
    If ws.Name <> "1" Then
                ws
    .Range(Ccell).Copy
                Sheet1
    .Select
                ActiveCell
    .Offset(10).PasteSpecial
            End 
    If
        
    Next ws

    End Sub 
    thank you for your respone!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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