+ Reply to Thread
Results 1 to 8 of 8

Creating a questionnaire from range.

Hybrid View

fabrecass Creating a questionnaire from... 02-01-2011, 06:39 AM
royUK Re: Creating a questionnaire... 02-01-2011, 08:01 AM
Domski Re: Creating a questionnaire... 02-01-2011, 08:12 AM
fabrecass Re: Creating a questionnaire... 02-01-2011, 08:13 AM
Domski Re: Creating a questionnaire... 02-01-2011, 08:36 AM
fabrecass Re: Creating a questionnaire... 02-01-2011, 09:49 AM
  1. #1
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Creating a questionnaire from range.

    Hi,

    trying to manipulate a range of data, not going too well so far, my VBA skills suck.

    i want to create a macro that removes a few cells with unwanted data in from a range that can vary in length, copies that range and pastes special:transpose onto a new worksheet, and turns each cell into a question by adding a question mark to the end of each cell (=cell&"?"), then some basic formatting i think i could manage myself.

    My macro gets as far as pasting onto the new worksheet, but i can't for the life of me figure out how to add the question marks!

    Hope this makes sense. can anyone help me?

    *edit: Sample workbook attached, apologies for breaking the rules. The terms "internal manufacturer guarantee", "group", "group name", and "group product" must be removed from range A14:40, though this range can vary in size. Sheet 1 shows where my macro crashes.*
    Attached Files Attached Files
    Last edited by fabrecass; 02-04-2011 at 09:44 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Creating a questionnaire from range.

    Can you set out the steps that your code is supposed to be doing
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Creating a questionnaire from range.

    This will add a ? to each value on the the new sheet:

    With Range("A1").CurrentRegion
        
        .Value = Evaluate(.Address & "&""?""")
        
    End With

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  4. #4
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: Creating a questionnaire from range.

    1. delete cells containing "group" and cell containing "internal manufacturer guarantee"
    2. Insert cells containing "series", "cat" and "product" at start of range
    3. copy range: cell containing "series":cell containing "EAN/Barcode no"
    4. paste special:transpose onto new worksheet
    5. add question mark to end of text in each cell
    6. paste values.

    I'm not sure if i'd being doing this in the 'correct' order, i'm sure you guys can simplify it somewhat. Hope that helps?

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Creating a questionnaire from range.

    Full code can be edited to:

    Sub DDS_Create()
        
        Cells.Find(What:="internal manufacturer guarantee", After:=ActiveCell, _
            LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Delete Shift:=xlUp
        Rows("14:16").Delete Shift:=xlUp
        Range(Range("A14"), Range("A14").End(xlDown)).Copy
        Worksheets.Add
        Range("A1").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=True
        With Range("A1").CurrentRegion
            .Value = Evaluate(.Address & "&""?""")
        End With
        
    End Sub

    Dom

  6. #6
    Forum Contributor
    Join Date
    02-01-2011
    Location
    london, england
    MS-Off Ver
    Excel 2016
    Posts
    179

    Re: Creating a questionnaire from range.

    Thanks for your swift reply, however the group values are not necessarily in A14:16, is there anyway that can be edited to delete relative to the cell number they may be in?

  7. #7
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Creating a questionnaire from range.

    Sure, can you explain the logic?

    Dom

+ 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