Simple (I think) problem

hallingh

Well-known Member
Joined
Sep 11, 2010
Messages
769
Hi all. I have a sheet that is archiving data and graphing it by quarter (First quarter of 2011, second quarter of 2011, etc.) My issue is, that in order for my graph to work correctly I need to have a column that contains the quarter in the format "1Q 2011." However, the user simply selectes from a drop down what quarter it is, and the choices are: "1st Quarter" "2nd Quarter" "3rd Quarter" and "4th Quarter". I'm using a macro to import the data, but currently I'm just importing all of the numerical data along with the year. This is the macro:

Code:
Sub ClearDoc()
ArchiveRows = (Sheets("Data Archive").Range("E" & Rows.Count).End(xlUp).Row) + 1
    Sheets("Data Archive").Range("A" & ArchiveRows).Value = ActiveSheet.Range("B" & (Q - 1) & ":B" & Q).Value
    Sheets("Data Archive").Range("B" & ArchiveRows).Value = ActiveSheet.Range("C" & (Q - 1)).Value
    Sheets("Data Archive").Range("C" & ArchiveRows).Value = ActiveSheet.Range("E" & (Q - 1)).Value
    Sheets("Data Archive").Range("D" & ArchiveRows).Value = [B]ActiveSheet.Name[/B]
[B]Sheets("Data Archive").Range("E" & ArchiveRows).Value = Year(Int(NOW())[/B]
    
 
 
End Sub

This highlighted code is what gives me the year, but I now need it to give me the Quarter and the year. The quarter is in the form "1st Quarter" in the cell:

Code:
ActiveSheet.Range("AM" & (Q-1))

Thanks for any help you can give me!

Hank
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Oh, forgot to say that Q and ArchiveRows are dimmed as Long in the actual sub. I'm sure you assumed that was the case.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,704
Members
452,938
Latest member
babeneker

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