Over 1 million tech questions and answers.

Excel 07 - Macro to hide/unhide rows

Q: Excel 07 - Macro to hide/unhide rows

I am building an excel model and want to link a macro to the "calculate" button based on the above check boxes. If the boxes are selected, the relevant graphs would need to unhide and show and then hide as the boxes are deselected again.

I've attached a screen shot of what I'm working on.

I would appreciate any help possible on how to write the code for this macro.

Many thanks

RELEVANCY SCORE 200
Preferred Solution: Excel 07 - Macro to hide/unhide rows

I recommend downloading and running Reimage. It's a computer repair tool that has been proven to identify and fix many Windows problems with a high level of success.

I've used it in the past to identify and fix everything from blue screens (BSOD's), ActiveX errors, corrupt files and processes, dll/exe/sys errors, recover lost memory, Windows update problems, defragging, malware removal etc.

You can download it direct from this link http://downloadreimage.com/download.php. (This link will automatically start a download of Reimage that you can save to your computer.)

A: Excel 07 - Macro to hide/unhide rows

Welcome to the board.

Screenshots saved as bitmaps are huge. Convert them to (e.g.) jpgs, then you can upload without zipping.

Re this part of your post specifically:

Macro to hide/unhide rows

, one "basic" answer is:

Private Sub CheckBox1_Click()
If CheckBox1 = True Then
Rows("11:20").EntireRow.Hidden = False
Else
Rows("11:20").EntireRow.Hidden = True
End If
End Sub

Do you actually have ten charts, or is it far more in reality?

Read other 2 answers
RELEVANCY SCORE 120.4

Hi there! I'm new to using these forums, but have spent some time scouring them from time to time to look for simple solutions to any excel/VBA problems I'm having. I consider myself relatively intermediate to advanced in Excel as far as formulas and spreadsheet creation goes, however VBA is foreign to me, and an area I'd love to learn. If any of you have recommendations on a good resource to begin learning VBA, please send it my way. And now....onto my macro question.

I've got a workbook with many tabs, and one or two input tabs feed information into another summary tab using various lookup and index formulas. There are any where from 40 to 80 rows to be qualified depending on the specific summary sheet (therefore I will likely need the macro to reference only the active sheet as it needs to work the same way on different sheets independent of each other). What I would like to do is if the result of the formula in column A of the summary sheet is "----------" (starts at A7) then I would like to hide that row, and if the data is changed on the input tab to result in anything other than the qualifying "----------", for that row to be unhidden. If this can be done dynamically that'd be great, however, if a button needs to be put into the spreadsheet to execute the macro, that will be fine too.

Thanks so much in advance for your help, and I promise I'll do my best to begin learning VBA so I can help contribute in return!
 

A:Macro to Hide/Unhide Rows Based on Results in Column Equation

HI,

Here is a code that may help you. You can copy and paste it too a module.
When you copy it to a module you can assign a "Short" cut key to activate the code.
To do this you select "Tool", "Macro" and when you see the name of the macro you want to run you can select it and then select "Options" and assign the short cut key. You will be able to use the short cut key on any active sheet.
Code:

Sub Hide_Row()
Application.ScreenUpdating = False
Dim Mysh As Worksheet
Dim cel As Range
Set Mysh = ActiveSheet
For Each cel In Mysh.Range("A1:A" & Mysh.Range("A65536").End(xlUp).Row)
If Not (Mysh.Cells(cel.Row, 1).Value Like "--*") Then
Mysh.Cells(cel.Row, 1).EntireRow.Hidden = False
Else
Mysh.Cells(cel.Row, 1).EntireRow.Hidden = True
End If
Next
End Sub
 

Read other 2 answers
RELEVANCY SCORE 115.6

I will eventually want this to work on all worksheets in the workbook as their data may change as the "linked tables" are refreshed. The linked tables are from Access.

What I want to do is look in column Q to see if the result of the calculation in that cell is 0. If so, I want the row hidden. I don't want to hide empty rows, just the one where the calculation =0. If the data in the workbook, i.e. the linked tables are updated, then I want any rows that have changed from 0 to another value to then become unhidden.

I have been searching for VBA code to auto hide/unhide rows in Excel 2007 based on the value in a specific column. I found the following code, but can't seem to get it to work quite right. I changed some of the criteria to fit my worksheet. The problem is that it hides all rows that are empty even though I changed the criteria from "" to 0. Also, this does not unhide rows that may refresh with a value.

I would really appreciate some guidance. My Access and Excel skills are pretty good, but when it comes to incorporating VBA into the mix, I get a little lost.

Sub HideEmptyRows()
'This macro hides all of the rows which are empty, for printing.
'created by Geoff Faulkner 12-29-2004

'Declare variables
Dim intStartRow
Dim intEndRow
Dim intTargetColumn
Dim intCounter

'set default values
intStartRow = 6
intEndRow = 2000
intTargetColumn = 17

'cycle through each row in the range
For intCounter = intStartRow To ... Read more

A:Solved: Excel 2007 Auto Hide/Unhide Rows

Read other 6 answers
RELEVANCY SCORE 115.6

Hello to all,

I'm new to VBA in general and I'm in need of help in making my project works. I'm currently working on hidden in-sheet menu (rows 2 to 6) that could by unhidden by double-clicking on the cell "D1" and hidden again by double-clicking on "A6". I want to use that menu in every sheets.

I would really appreciate any inputs on this matter. Feel free to view my spreadsheet for a better idea.

Thanks in advance!
 

Read other answers
RELEVANCY SCORE 109.2

I have spreadsheet that has a bunch of parts listed in separate categories. Column A is the quantity column. I want to be able to hide all rows (using a macro) that have a zero in column A. The workbook has several sheets that need the same functionality. The macro must not hide rows with nothing in them or nothing in column A. For example a row may have content in other columns but nothing in column A because that row is not used for a specific part (therefore there will never be a quantity entered).

The code below works great except that it hides all rows with that are zero or blank. I just need to figure out how to make it skip the blank rows (column A has no data). Any ideas? It doesn't have to be with my code just something that provides this function for all sheets in the workbook. Thanks.

Option Explicit
Sub HideRowsWithZeros()
Dim ws As Worksheet
Dim c As Range
Dim rngRange As Range

Application.ScreenUpdating = False

For Each ws In ActiveWorkbook.Worksheets

ws.Select
Set rngRange = Range(Cells(1, 1), Cells(65336, 1).End(xlUp))

For Each c In rngRange
If c.Value = 0 Then
c.EntireRow.Hidden = True
End If
Next c

Next ws

Application.ScreenUpdating = True

End Sub
 

A:Excel Macro to hide rows

Read other 6 answers
RELEVANCY SCORE 106

I have a drop down list in D1 and what I need is a macro that will search for the selected value through column D and hide the rows that don't match. Think of it as like the autofilter function in excel.
 

A:Solved: Excel macro to hide rows if value does not match header

Read other 9 answers
RELEVANCY SCORE 102.8

I am trying to hide rows of my worksheet that show a date in the completed column.
The orders that are complete have a date in column F up to this point I highlight them green so I know they are completed but it would be nice if they highlighted green and were hidden when a date was entered into the completed column.
Can someone assist me with creating a macro that will do this?
I am very new to macros so please forgive my lack of knowledge.

I have attached a sample of what I am doing however inf has been changed.

I am using Excel 2007

Thank you,
 

A:Solved: Macro for excel 2007 to hide rows based on any data entered in a column

Hi, welcome to the forum,

I put some simple code in the Sheet's vba

Make sure you allow macro's to be run

Just enter a date in the last row of column F for testing.

For the other green rows, just click in column F and update the date by retyping it
 

Read other 3 answers
RELEVANCY SCORE 97.2

Hi! Good Day!

I cant find ways to automatically hide & unhide row depending in G14, G15 & G17. I dont know if it is applicable to Excel. Even if the solution is in other programming language, then its ok to me.

If G14=4 & G15=3 & G17=2 then hide row 28 to 29 & row 36 to 38 & row 43 to 46

I have attach a file for reference.

Thank you so much!
 

A:Auto Hide & Unhide Rows per data input

This is on the assumption that your rows are not fixed and that your code is AB#.
 

Read other 1 answers
RELEVANCY SCORE 97.2

Hello to evrebody,
I have look into the answers and the solutions about "hide/unhide rows based on the cell data" but i am not abble to understand how its work and apply to my sheet.
On theattached sheet i explain what im looking for.
Pleaseo play it and hope to help me and give a solution please.
Thanks in advance.
Jose
 

Read other answers
RELEVANCY SCORE 95.2

Good day everyone.
Basically I need to have a formula in excel that includes auto hide and unhide of rows based on the result value. Attached is my sample exercise for quick reference. In this exercise, I want to hide automatically the rows under "REPORT OUTPUT" that contains "0" ZERO value. Basic guide: Once you enter value (from 1 to 5) in cell D3, report output will automatically calculate...... The missing condition in the formula is to automatically hide ZERO value.... Please help.
Thanks in advance.
 

A:Solved: Formula with auto hide and unhide rows based on result value

Read other 16 answers
RELEVANCY SCORE 92.4

Hello

Yesterday I created a code that hides/unhides rows when checkbox is clickedand goes something like this:

Rows("22:24").EntireRow.Hidden = Not Rows("22:24").EntireRow.Hidden

But now i only want to hide/unhide specified cells. So how can i modify the code above to do this or do I need some new code.

Thanks for help
 

A:macro to hide/unhide cells

"hide/unhide specified cells" - I take it, you mean rows, not cells.

What's your criteria for hiding/unhiding the row? All you need to do is loop through each row in your criteria column, and then program this in as your hide/unhide criteria.

Pseudo Code:

Code:


Sub hideAndUnhide()
[INDENT]For Each Cell In Range("A1",Range("A1").End(xlDown))
[INDENT]If(Cell.Value = 1) Then
[INDENT]Rows(Cell.Row).EntireRow.Hidden = True [/INDENT]
Else
[INDENT]Rows(Cell.Row).EntireRow.Hidden = False[/INDENT]
End If[/INDENT]
Next Cell
[/INDENT]
End Sub

If you let me know your data layout, and your criteria, I should be able to make a proper version for you. Even better would be to post your excel sheet with dummy data (remove any sensitive data).
 

Read other 2 answers
RELEVANCY SCORE 90

Hello,
I have an Excel file where I track repairs that are sent out to various repair centers. What I am having trouble with is this: Right now I have a formula that calculates the estimated delivery date based on the lead time and ship date. Works fine. But in the rows where there is no data, the formula still shows. And since there is no start date or lead time entered, I have a long column of 1/0/1900 becuse the formula does not see a start date or lead time. What I want to do is have this not show up until I enter the start date. I need this to work automatically, kind of like how Microsoft Projects works but not nearly as expensive. Any help would be appreciated!
Thanks!
 

A:Auto unhide rows in excel

Read other 6 answers
RELEVANCY SCORE 87.2

Hi Again

CodeLexicon gave me a code that worked very well in hiding column A only. Is it possible to make the macro hide all columns with all zeros?? Also I tried to change CodeLexicon's macro to do hide all rows whose columns have zeros but without success. I tried to make the code generic.

Attached is a workbook with the 2 macros. Test the macro that I did out and see that it only hides row A only.

Mario
 

A:Solved: Macro to hide all rows whose columns have zeros

Read other 6 answers
RELEVANCY SCORE 86

with regards activex checkboxes in excel, i know you can hide or unhide the said boxes by going to properties and changing the visable section from true to false, can this also be done by using code so if a visable checkbox on the worksheet is ticked this will then display other hidden checkboxes
your help is appreciated
thanks
 

A:Solved: hide unhide excel

Yes, that can be acieved. The best thing to do is attach a copy of your workbook (replace sensitive data with dummy data), so that we all can take a look at your worksheet(s) structure.
 

Read other 1 answers
RELEVANCY SCORE 84.8

i am using a userform with a listbox that a user chooses a value, that value is then placed in sheet 15 at cell 29, what i would like is if the value chosen is 6 then rows c6 - c25 in sheet 15 are unhidden otherwise they remain hidden, i have managed to do this before using checkboxes but not via a userform, any ideas for code please
 

A:Solved: excel hide/unhide on cell value

You need to trigger a macro which can be called from the form.

When a value is chosen, the macro triggered will be something like

To hide:
Range(Cells(6,1),Cells(25,1)).entirerow.Hidden = true

To Unhide:
Range(Cells(6, 1), Cells(25, 1)).EntireRow.Hidden = False
 

Read other 2 answers
RELEVANCY SCORE 84.8

I hid columns D through AN on a spreadsheet. I then realized that I needed some information from column D. Is there a way to unhide one column from a group that you've hid Right now I have to unhide one column at a time to get back to the one that I need. Any help would be appreciated
 

A:Solved: An Excel Hide/Unhide Question

Press F5 -- type D1 -- press Enter.

Then Format > Column > Unhide.
 

Read other 2 answers
RELEVANCY SCORE 83.2

I built my pivot table now I would like to be able to hide/unhide certain elements in my pivot table. How do I do this? is there a way to toggle on/off certain elements I want to appear without having to reselect elements for the table?
 

Read other answers
RELEVANCY SCORE 83.2

Is there a way in Excel (I'm running Excel 2010, but have access to older versions) to hide/unhide cells based on hyperlinks or defined areas? I've hyperlinked so that we could go to specific parts of the document, but that does me little good because we have to hide them or the doc gets to big. Is there a way to have the hyperlink (or the cell hyperlinked) unhide the area? I've attached the document (removed all company info, but the lay out is there) so that you can see what I'm referring to.

I've thought macros, but I'm not sure how to go about it... I did define each area for the hyperlink, so would that be the route to go?
 

A:Excel - Hide/unhide based on defined cells/hyperlinks?

Read other 6 answers
RELEVANCY SCORE 82.8

Hello,

I need help to create an Excel macro that would

1. ask users to select x number of rows to be copied from one worksheet of one Excel file
2. once users have selected the rows to be copied, then the rows are copied from the one original Excel file into X number of target Excel files

Notes:
the target Excel files are all based on the same template
there is one worksheet in each of the target Excel files

in the target files, the rows should be copied from the first available empty row, going down

Looking forward to your help!

Thanks a lot.
Mzz
 

A:Macro needed to copy x number of rows from one Excel file into a batch of Excel files

Hi, welcome to the board.
Not much info there to get the correct picture.
Sample? Of source and template please
And not to forget, what version of Excel are you and the users using?
 

Read other 1 answers
RELEVANCY SCORE 82

Hi All,

So I'm fairly competent in Excel in most things other than macros (which means it could be argued I know nothing about Excel...)

I'm looking for a way to automatically hide rows from a page. Essentially it's a progression tracking sheet that I've got, and I want things to stay on the sheet for only 5 days after the job is complete. I have a TODAY() function which I am using to determine whether or not it has been 5 days since completion.

Any advice would be more than appreciated and I thank you all in advance.

Tom
 

A:Excel: Automatically hide rows based on value

Bumping due to inactivity. Not sure if it's allowed but hey, I still haven't got an answer...
 

Read other 2 answers
RELEVANCY SCORE 80.8

Hi all, long time reader, first time poster. I searched around and have found similar queries to what I require however I haven't been able to adapt these solutions with any success so here we go....

I have a list of businesses in a spreadsheet with information such as name, phone number, e-mail, website, postcode etc. I would like a search box on the side, say in cell O2 where a user can input part or all of a postcode e.g. (LS19 or LS) and those that do not begin with LS would be hidden. The postcodes are in column G.

I'm trying to make this as simple and user-friendly as possible so employees can find businesses in a certain area with ease. Thanks in advance for any help and please feel free to ask questions.

Chris Needham
 

A:Excel VBA : Hide rows based on cell input.

Seems nobody had the answer so I found a work around myself. Just in case anybody else wants to do a similar thing. Using auto filter is the easiest way.
Code:

[SIZE="3"]Sub Search()
Columns("G:G").Select
Selection.AutoFilter
ActiveSheet.Range("$G$1:$G$999").AutoFilter Field:=1, Criteria1:="*" & Range("O2").text & "*", _
Operator:=xlAnd
End Sub[/SIZE]

Where G is the column to search for and O2 is the users input data.

Guess this can be closed now, thankyou all for your help.
 

Read other 1 answers
RELEVANCY SCORE 80.8

How do I hide and show different columns based on values selected from a drop-down list? I wrote a code to do this but there has to be an easier way.

Cell C2 has a drop-down list. This list is from another part of the workbook. Next to the list in the workbook, I put values representing the beginning of the columns I want to Show.

Units 4
Intervals 5
Time 6
All 0

On the page that I am working with I have created a spreadsheet that tracks monthly amounts of Units, Intervals and Time (in separate columns). I want to be able to select "Units" from C2 and show columns, 4, 7, 10, 13... +3 each) then be able to show Intervals (and only show columns 5, 8, 11, 14... etc), then Time (and show columns 6, 9, 12, 15... etc) and if I select All, I want to show everything.

Dim x As Integer
Dim vCriteria
vCriteria = Range("C4")

If vCriteria = "0" Then
Columns("D:AS").Select
Selection.EntireColumn.Hidden = False

Else
Columns(vCriteria).Select
Selection.EntireColumn.Hidden = False

Columns(vCriteria + 3).Select
Selection.EntireColumn.Hidden = False
Columns(vCriteria + 6).Select
Selection.EntireColumn.Hidden = False
Columns(vCriteria + 9).Select
Selection.EntireColumn.Hidden = False
'... and repeat til vCriteria + 40 (column AS)

End If
End Sub

This works. But....
There has to be an easier way to write this code. Additionally, I want to be able to add more more columns to this spreadsheet as it is tracking monthly numbers so I don't wa... Read more

A:Excel VBA: Show/Hide rows based on dropdown value

Read other 8 answers
RELEVANCY SCORE 80.8

In sheet 1, I have a list of data in A221. In sheet 2, I have formulas in the same range that ‘paste link’ the data. If, there is no data entered in any one entire row of the same range in sheet 1, then I want the entire row to hide automatically in sheet 2. In fact, unless there is something entered to start with, I do not want any of the rows to be visible. Is this possible and how? Thanks.
 

A:auto hide empty rows excel 2003

Its still me, jmannsr, trying to figure this forum out. I have an excel work book that I would love to attach or send to someone that would explain what I need help on. Any ideas how to attach an excel book here or any one willing...I can email it directly to you? Thanks!
 

Read other 3 answers
RELEVANCY SCORE 80.4

Hi

I am looking for help on VBA to unhide a specific sheet to enable the macro to run, then once complete to rehide the sheet.

Code I have so far is as follows:

Application.ScreenUpdating = False
Sheets("IRIS_JNL_W2.1").Select
Range("A2:C500").Delete

Sheets("IRIS_JNL_W2.1").Select
Range("A1").Select
ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[3]-'W2-1'!R[9]C[4]"
Range("B1").Select
ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[1]"
Range("C1").Select
ActiveCell.FormulaR1C1 = "=""W2-1 - Jnl No.""&'W2-1'!R[9]C[-2]"
Range("A2").Select
ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[3]-'W2-1'!R[9]C[4]"
Range("B2").Select
ActiveCell.FormulaR1C1 = "='W2-1'!R[9]C[1]"
Range("C2").Select
ActiveCell.FormulaR1C1 = _
"=IF('W2-1'!R[9]C[-2]="""",IRIS_JNL_W2.1!R[-1]C,""W2.1 - Jnl No.""&'W2-1'!R[9]C[-2])"
Range("A2:C2").Select
Selection.AutoFill Destination:=Range("A2:C500"), Type:=xlFillDefault
Range("A2:C500").Select
Last = Cells(Rows.Count, "A").End(xlUp).Row
For i = Last To 1 Step -1
If (Cells(i, "A").Value) = "0" Then
Cells(i, "A").EntireRow.Delete
End If
Next i
Columns("A:C").Select
Selection.Copy
Selection.PasteSpecia... Read more

A:Solved: Unhide sheet, to run macro, then hide sheet

to hide
worksheets ("IRIS_JNL_W2.1").Visible=False

to show
worksheets ("IRIS_JNL_W2.1").Visible=True

Peace be upon you
 

Read other 1 answers
RELEVANCY SCORE 80

I am trying to come up with a code that will cut one or multiple rows and paste to a different sheet. The determination of what rows to cut is if it goes one day past the date in Column D.
Can anyone provide any guidance?
 

A:Excel Macro/Cut & Paste Rows

Hi, with the information you have given us (not much), a macro will do the job.
You could either make it event-driven or manual.
kevcott9 had a similra question but not with a condition in column D, but the idea would be the same, copy rows to different sheets.
This is event driven.
I've attached the file with the code I 'wrote' for him, maybe you can change it and use it too.
 

Read other 2 answers
RELEVANCY SCORE 80

I need some help in creating a macro in Excel 2010 for deleting rows that contain specific characters (the pound sign) in the text. I cannot get it to recognize the # as text. Also the # is embedded as part of a line of text which varies, so I also need a wildcard. Any help is greatly appreciated. thanks.
 

A:Excel macro for deleting rows

use instr("original text", "#")
 

Read other 1 answers
RELEVANCY SCORE 80

I'm not sure what this is called (possibly dynamic named range) so I will try to explain. I am trying to update a macro that was written by somebody else. In the macro he used row numbers. I have added rows within the referenced area and now the macro pulls information from the wrong rows. I want to change the macro to allow for more rows whenever I feel like we need to add them. The piece of the code that I want to update is below. If I change the row numbers, it works properly, but I need them to allow for movement. I'm not sure how the rest of the macro uses this piece, so if I need to post the rest of the macro or the actual document, please let me know.

'Project Level Documents
rowHeader = 1
rowPDDstr = 2
rowPDDend = 5
rowTOGPMstr = 6
rowTOGPMend = 8
rowRAstr = 9
rowRAend = 12
rowSOWstr = 13
rowSOWend = 13
rowTestStrategystr = 14
rowTestStrategyend = 14
rowImplementation_and_Transition_Strategystr = 15
rowImplementation_and_Transition_Strategyend = 15
rowIssue_Mgmtstr = 16
rowIssue_Mgmtend = 17
rowRisk_Mgmtstr = 18
rowRisk_Mgmtend = 21
rowChange_Mgmtstr = 22
rowChange_Mgmtend = 25
rowProject_Planstr = 26
rowProject_Planend = 26
rowProject_Statusstr = 27
rowProject_Statusend = 27
rowProject_Reviewstr = 28
rowProject_Reviewend = 29
 

A:Excel Macro to allow adding rows

Hi, Welcome to the forum.
This is something I tell every poster.
Please start by telling us which version of Excel you're using.
What you explain may be clear to you but try and envision somebody who has no idea of what you're intending to achieve.
I do suggest you attach a sample (copy) of you file with non-private data and add some informtaion there, somehting like showing a 'before' and 'after' so that one us can understand what you need.
 

Read other 3 answers
RELEVANCY SCORE 80

Hello

I am a total vba beginer and really need some help. I just can't get my head round the following. Any help would be so very much appreciated.

This is what I am trying to do-

I have a sheet with many columns of info. This info is basically a listing of the fruits that Shop A, B and C sell and the different prices and other stats. I want to copy across the rows of info for each shop, sort by fruit but exclude some of the stats.

example,

If column 2 equals shop A and column 12 equals pears, then copy the row of info into the new sheet but only the info in columns 2,5,8,12 and 18. I then want a blank row
Then I want if column 2 equals Shop A and column 12 equals apples, then copy the row of info into the new sheet but only in the info in columns 2,5,8,12 and 18.
Then I want a blank row
Then I want if column 2 equals Shop A and column 12 equals peaches, then copy the row of info into the new sheet but only in the info in columns 2,5,8,12 and 18.
Then a blank row and repeat process for Shop B and C

If Shop A/B/C has no apples/peaches/pears then nothing will be returned

After each shop's fruit has been listed I want to total up the prices (column 18 in the orginal sheet)

And then I want a grand total of Shop A+ shop B +Shop C as the last line.
I hope I am clear

Thanks so much in advance
 

A:Excel Macro that copies whole rows

Read other 7 answers
RELEVANCY SCORE 80

Ok here is what I have.

I am working on a report that would identify duplicate rows on a spreadsheet and hightlight them.

As of right now I am useing:

Code:

=IF(AND(E3=E2,Q3=Q2),"Repeat","Unique"))

Then I highlight all the "Repeat" rows and resort them.

I was I have tried to come up with a macro and do not have much other then how to get the cells to highlight
Code:

With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With

I do know I am going to have to use an IF statement in the VB but not sure what comes next.

Thanx in advance.
 

A:Excel - Macro to hightlight dup rows.

Read other 9 answers
RELEVANCY SCORE 80

Hi All,

I'm pretty good at Excel and VBA, however I'm a little stumped on a request I've had from one of my Excel users. What we want to be able to achieve, if even possible, is for particular rows to be hidden & locked unless the user has a specific password.

The table is laid out proper table format, with each row representing a record, and each column representing a field.

We want to be able to hide and lock from viewing the top, say, 5 records from view, as we need to be able to distribute the whole workbook via Email and other Web services, whilst keeping the top 5 sensitive records hidden, until a password is typed in.

Any ideas, any one.

Ps. I realise a database would make more sense, unfortunately this is unpractical, as we use WAN servers (not good for Access), and several external contractors, who need a copy of this workbook. As well as Senior Management, not wanting an Access DB.
 

A:Excel VBA: Hide and lock specific ROWS from viewing without Password

Read other 9 answers
RELEVANCY SCORE 80

Hi all,

How do you ensure excel autohides blank rows that are in various formats and still shows values that do have values? (eg. $.00)

This thread has helped:

http://forums.techguy.org/business-applications/385564-solved-autohide-rows-excel.html

However, for some reason - if the cells are in $.00 format and have values in them - they are also hidden.

Thank you,
 

Read other answers
RELEVANCY SCORE 79.2

Hello!

I wonder if someone could help me? I'm trying to combine multiple rows into a single row. My data currently is formatted:

E-mail,First Name,Last Name,Event,Ticket Name,Spaces
[email protected],John,Taylor,C,81,5
[email protected],Mary,Smith,A,81,2
[email protected],Mary,Smith,D,144,1
[email protected],Mary,Smith,I,81,1
[email protected],Mary,Smith,G,82,1
[email protected],John,Taylor,A,81,2

I'd like to be able to combine rows so that my data looks like this:

E-mail,First Name,Last Name,Event,Ticket Name,Spaces,Event,Ticket Name,Spaces,Event,Ticket Name,Spaces,Event,Ticket Name,Spaces
[email protected],John,Taylor,C,81,5,A,81,2
[email protected],Mary,Smith,A,81,2,D,144,1,I,81,1,G,82,1

I found a macro on an old techguy thread which just about does the job, only it keeps repeating the last name and doesn't reprint the header. I've tried to edit it but I know nothing of Visual Basic and can't figure out how it's working. Here's the code from that thread:
Code:
Sub test()
MainSheetRows = Range("B" & Rows.Count).End(xlUp).Row
For Each Cell In Range("B1:B" & MainSheetRows)
x = WorksheetFunction.CountIf(Range("New!B:B"), Cell)
If x = 0 Then
y = WorksheetFunction.CountA(Rows(Cell.Row))
Cell.Offset(, -1).Resize(, y).Copy Sheets("New").Range("A" & Rows.Count).End(xlUp).Offset(1)
Else
y = WorksheetFunction.CountA(Rows(Cell.Row)) - 2
z1 = ... Read more

Read other answers
RELEVANCY SCORE 79.2

Hi All,

I have a spreadsheet containing 30 address blocks that I'm trying to clean up. A sample is attached.

All of the data is in column A. Each address block is 6 rows, like this:

Name
Company Name
Street Address
City/State/Zip
Phone number
Email Address

Between each 6 row block is a varying number of additional rows that might or might not contain extraneous information. I want to remove those extra rows leaving only the address blocks.

I'm thinking about counting the "x" number of rows between email address "@" symbols, and then just deleting X-6 rows. But I'm not sure how to accomplish this.

Any ideas how this might be accomplished, or any better suggestions to accomplish the goal?
 

A:Solved: Excel macro/vba to delete rows

"might or might not contain extraneous information"

For Each Cell In Range("A1", Range("A" & Rows.Count).End(xlUp))
If InStr(Cell, "@") <> 0 Then
Cells(Cell.Row - 5, 1).Resize(6, 1).Copy Range("B" & Rows.Count).End(xlUp).Offset(1)
End If
Next Cell

If those are real names and addresses, you should remove your file.
 

Read other 2 answers
RELEVANCY SCORE 79.2

Hi,

I have data in the following row format:

0 4591 5 4491 10 4461 15 4441 20 4321

The data are X and Z points so the above example shows 5 pairs of data. I would like to place these pairs of data sequentially in two columns where one column has all the X's and the other has the related Z's. I have many, many rows of similar data that I need transferred into two columns.

0 4591
5 4491
10 4461
15 4441
20 4321

Could anyone help me out with a macro that can do this for me?

Thanks very much in advance.
 

A:Solved: Excel Macro - Rows to Columns

Welcome to the board.

Let's say the example pairs are in A1:J1.

With A1:J1 selected,

Sub test()
For Each Cell In Selection
If Cell.Column Mod 2 = 1 Then
Range("A" & Rows.Count).End(xlUp).Offset(1) = Cell.Value
Else
Range("B" & Rows.Count).End(xlUp).Offset(1) = Cell.Value
End If
Next Cell
End Sub

gives you actual pairs in A2:B6.

So, what do we need to adjust to make it compatible with your "many, many rows of similar data" scenario?
 

Read other 3 answers
RELEVANCY SCORE 79.2

I am trying to create a code that will autofilter data on an Excel worksheet. The code works fine to filter the data, but it does not hide the AutoFilter Arrows.

Below is the code I am using. What (if anything) is wrong with the code below?
Code:

ActiveSheet.Range("A1:D500").AutoFilter Field:=2, Criteria1:="<>", Visibledropdown:=False
 

A:Solved: Excel 2007 Macro -> Hide Excel AutoFilter Arrows

I noticed that the code above (in Post #1) that the AutoFilter Arrows were beinf truned off on Field 2, but none of the others.

I have played around, and done some research to come up with the code below:
Code:

Dim c As Range

For Each c In ActiveSheet.Range("A1:D1")
ActiveSheet.Range("A1:D500").AutoFilter Field:=2, Criteria1:="<>"
c.AutoFilter Field:=c.Column, Visibledropdown:=False
Next

Does anyone have a better solution?
 

Read other 1 answers
RELEVANCY SCORE 78.4

I am trying to find a way to find a specific text within a worksheet, select that cell and the 9 rows under that row, and delete the 10 rows.
 

A:Solved: Excel Macro -> Delete Multiple Rows

Read other 16 answers
RELEVANCY SCORE 78.4

I have a flat file that when I read it into excel it populates column 1 of each row with data.
This data is actually a series of 5 fields that I need to have in columns and rows, that is,
column a1 thru a5 I need placed in a1, b1,c1,d1 and e1 followed by
column a6 thru a10 placed in a2,b2,c2,d2 and e2.
The data is balanced, that ism there is data in each of the 5 fields for a "record".
Any help would be appreciated.
THanks
 

A:Solved: excel macro to move columns to rows

Read other 8 answers
RELEVANCY SCORE 78.4

Hello - I found a previous post on this site that solves (I think) 90% of what I need to accomplish. I have a large spreadsheet that I need to:

· Delete column C
· Delete all rows without account numbers (Acct numbers will always be in column A)
· Delete all rows that have dates in column F other than &#8220;00/00/0000&#8221;.

The code I found on this site is :

Simple vba code:
lastrow = Range( "A65536").end(xlup).row
For y = LastRow To 2 Step -1
If Cells(y, x).Value = "" Then Cells(y, x).Delete shift:=xlUp
Next y
Set the range to the the column desired, in this case "A"
Lastrow checks the last row and starts from the end up.
Removes all empty rows entirely up to row 2 because row 1 generally is the header
Happy coding
Can anyone help me?
 

A:Excel VBA Macro to delete rows/columns with criteria

To delete column c, use:
Code:
Columns("E").EntireColumn.Delete
Delete all rows without account numbers (Acct numbers will always be in column A)
and
If Cells(y, "A").Value = "" Then Cells(y, "A").Delete shift:=xlUp

Use:
Code:
lastrow = cells(rows.count,1).end(xlup).row
For y = LastRow To 2 Step -1
If Cells(y, "A").Value = "" Then Rows(y).EntireRow.Delete
If Cells(y, "F").Value = “00/00/0000” Then Rows(y).EntireRow.Delete ' Delete all rows that have dates in column F other than “00/00/0000”.
Next y


 

Read other 1 answers
RELEVANCY SCORE 78.4

Hello - I found a previous post on this site that solves (I think) 90% of what I need to accomplish. I have a large spreadsheet that I need to:

· Delete column C
· Delete all rows without account numbers (Acct numbers will always be in column A)
· Delete all rows that have dates in column F other than “00/00/0000”.

The code I found on this site is :

Simple vba code:
lastrow = Range( "A65536").end(xlup).row
For y = LastRow To 2 Step -1
If Cells(y, x).Value = "" Then Cells(y, x).Delete shift:=xlUp
Next y
Set the range to the the column desired, in this case "A"
Lastrow checks the last row and starts from the end up.
Removes all empty rows entirely up to row 2 because row 1 generally is the header
Happy coding
Can anyone help me?
 

A:Excel 07 MACRO to delete rows/columns w/ criteria

Delete all rows without account numbers (Acct numbers will always be in column A)Click to expand...

If there are no acct numbers, will there be

blanks ""
Space " "
dash -
other ??
Can you provide a sample with dummy data so we can see the data structure?
 

Read other 1 answers
RELEVANCY SCORE 78.4

Hi,
I am trying to sort the colored rows, copy and paste it in particular format.
I have attached a sample excel file.
1. A cell has values which are Purple in color.
2. B cell has values, yellow, Blue and White in color.
3. I want concatenate A-Purple, B Yellow and paste it in next work sheet "Result"- Col2
4. Blue rows need to be copied and pasted to Col2
5. White row need to get pasted to Col4
6. Want to repeat this for whole worksheet.
Can you please suggest a macro for this?
Thanks,
 

A:Need excel Macro for copy paste colored rows

Read other 7 answers
RELEVANCY SCORE 78.4

If you check the file attached.

please can you help me in moving data with duplicate names to have the 2nd and 3rd email address moved to a new column and delete the row

need an excel macro to automate this as i am working with a large number of records like this in one excel sheet. i.e, i want to select the sheet and move data in every 2nd row to the columns in row above at the end of columns in that row.
 

A:Excel Macro to Move data in Rows to column

I'm unable to understand the entire requirement, but for moving the records with duplicate names, I've written few lines. This will cut the duplicate record rows (Consider "Pupil Forename" for removing)from the "Report Data" and will post into "Sheet3". Before running this macro please insert "Sheet3". Let me know your requirement, hope I will be able to resolve it out. Thanks!

Code:
Sub test()
Sheets("Report Data").Select
Dim trow As Long
trow = ActiveSheet.UsedRange.Rows(ActiveSheet.UsedRange.Rows.Count).Row
For i = trow To 1 Step -1
If i = 1 Then
Exit Sub
End If
If Cells(i, 1).Value = Cells(i - 1, 1) Then
Rows(i).Select
Selection.Cut Destination:=Sheets("Sheet3").Range("A65536").End(xlUp)(2)
End If
Next i
End Sub
 

Read other 2 answers
RELEVANCY SCORE 78.4

Hello, all. I'm looking to get assistance in creating a Macro to help format and move data in an Excel file: I have an Excel file with over 12,800+ rows and over 20+ columns, of data from about 192 companies (spanning ~16 years - 1994 - 2010 for each company).

Trouble is that there are several entries per year for each company.

What I want to do is to have every year, per company, be on one row: so I want to move the data for the same years, which come on different rows (in the data file), to the end of the row with the very first data for that year, which would make one long row (eg. if 5 rows of year 1999, make into 1 row of year 1999 by concatenation, and so on etc). And do this for each year for all the 192 companies.

Doing this manually is just inefficient, time consuming, and possibly prone to mistakes.

I've been told that a macro can do this, but as I'm a novice Excel user, don't know how to go about doing that. Even customer service & technical support at Microsoft weren't able to help me very much: they directed me here.

I have screen shots (of a simple spreadsheet I created) if anyone needs further clarification.

In the pictures, I only did the first company. But this is to happen for each year for all of the companies.

Please help. Thanks.
 

A:Help needed in trying to create a Macro? to cut, and concatenate rows in Excel

Read other 16 answers
RELEVANCY SCORE 78.4

Hi
I have set up the following macro to enable users of the spreadsheet to insert a row and copy the formating and formula's. For some reason, when I go to insert a new row again, it inserts the row in a completely random place and not in the exact same place. People may want to add 20 rows one after the other to populate and I am trying to enable them to do this without having to worry about the formulas in there (I want to protect the formula's to ensure they don't overwrite them). Can anyone help? This is my code from Excel 2007 (I recorded a macro, I am not competent and writing them from scratch):

Sub InsertRowStock()
'
' InsertRowStock Macro
' Insert a row into the stock sheet and copies all formats and formulas
'
' Keyboard Shortcut: Ctrl+i
'
ActiveCell.Offset(27, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
 

A:Macro to insert rows into Excel 2011 spreadsheet

Just one other thing, I think the rows it is inserting are every 27 rows down but I want a row always to be inserted in the one specific place on the worksheet.
 

Read other 1 answers
RELEVANCY SCORE 78.4

Hi, I'm new to macro. Hope you can help me with my problem. I've been stuck with this for a week with no result.

I have this table:

001 002 003 004
111 115 119 123
112 116 120 124
113 117 121 125

Let's say, the first row are the StoreID and all other digits below them are the ProductID

I want to convert this table into something like this:
001 111
001 112
001 113
002 115
002 116
002 117
003 119
003 120
003 121
004 123
004 124
004 125

I haven't made any macro before in MS Excel and this one is really getting the breath out of me.

Hope you can help me please.. I'd really appreciate it.

Thank you in advance!
 

A:Help with Macro in excel - Convert Rows to Repeating Columns

is this just a "one off" thing or do you have many sheets to convert? Because for one or a few sheets, it is not a lot of work to do manually...probably take a few minutes ( I 'll explain if you need)

to automate I can do it, but I need to build some loops and references to refer to the columns and ranges to move to a new list...it's a bit of work.

Please confirm also if it is only 4 columns, and or if the column count varies
 

Read other 1 answers
RELEVANCY SCORE 78.4

I need to create a macro in Excel that will look for a certain text within a column (Column A), Copy the data in another column (Column B), and paste the data in another column (Column C).

For Example....

Column A
ABC1
ABC1
ABC1
ABC1
ABC1
DEF2
DEF2
DEF2

Column B
1000
1500
78
562
235
89
456
258

So, I would like to copy all the data in Column B that correspond with "ABC1" in column A, and paste that data in Column C.
 

A:Solved: Excel Macro Search and Copy Rows

Read other 16 answers
RELEVANCY SCORE 78.4

Hi, I have approx 25,000 rows of data relating to parts held in inventory, on a spreadsheet in Excel 2003 SP2 .

One common cell on each line is the Supplier Stock Code and the data in it is duplicated on different rows as the same Supplier Part is held under several different Part ID's on our system, ie,

Cell A2 0-320311-00
Cell A3 0-320311-00
Cell A4 0-320311-00
Cell A5 0-330317-29
Cell A6 0-330317-29
Cell A7 0-330317-29
Cell A8 03400BK08345
Cell A9 03400BK08345
Cell A10 03400BK08345
Cell A11 03400BK08345

I have sorted the data into Supplier Stock Code order and need to find a way to automatically insert a blank row (or two) after each change, ie, in the example above it would be between rows 4 & 5, and 7 & 8.

Does anyone know of a Macro which will do this?

Many thanks,

MarG38
 

A:Solved: Excel Macro to automatically insert rows

First things first -- welcome to the board.

2nd thing:

"insert a blank row (or two) after each change"

Hmm: for what purpose? The "official" line is "DON'T do that, it's VERY bad design". K?

So what I did was drag your last entry down to r25000, to generate 03400BK08346,
03400BK08347, and so on. "Test data".

Then I ran the code at the bottom of this post. It ground away for 12 minutes (make coffee, visit bathroom, yada yada) & then fell over on account of "ran out of worksheet" (bear in mind I had c.25K unique values, you have far fewer).

Last (but most definitely not least) thing: back up your work before trying the code.

HTH

Sub test()
Application.ScreenUpdating = False
LastVal = Range("A" & Rows.Count).End(xlUp)

Do Until LV2 = 1
x = Range("A" & Rows.Count).End(xlUp).Row
x = Range("A" & x).End(xlUp).Row

If Cells(x, 1) = LastVal Then
LV2 = 1
Else
y = Application.Match(Cells(x, 1), Columns(1), 0)
z = WorksheetFunction.CountIf(Columns(1), Cells(x, 1))
Cells(y + z, 1).Resize(2).EntireRow.Insert
End If
Loop

Application.ScreenUpdating = True
End Sub
 

Read other 2 answers